Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp888160rdb; Wed, 6 Dec 2023 02:55:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLQbZlAUwPnNc1Ks+dAWtixyKtvtWztHWqrGrrYj0WLD/evhtfTe+VbKceQNNJFjvEuU7d X-Received: by 2002:a05:6a00:4c10:b0:6cd:f91e:dfe4 with SMTP id ea16-20020a056a004c1000b006cdf91edfe4mr839330pfb.2.1701860138504; Wed, 06 Dec 2023 02:55:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701860138; cv=none; d=google.com; s=arc-20160816; b=UeyROmh1kQn71iht9Fj2bXLNm7rcOhbXKzCxD9Y1Uax42bqCaEkm5WciE+t34IbyTC U0jLwLQcQjYkZZ4v4Cf+UWI8czow0zJWKPN5nqDy4E485/yhA61yFpWCGjXmCjqfsnqg ptKdZig3Bo/qwGtUIKDy25W8VzThhWmu5JHgqCWNfjirY5j4QGet+cbGl45ESdZ+nDtQ oM+xOSJ2BMAfDUMboJxuECIApHatROYLBYTa3wO27rZbGS8LN/iOi4oPmkPo2CofzrMz QQgWl+h2aviNuM/hxzDG1zD0sm0O3OipvoWr/XXiGZEza54wbrrCcyGLJPOuK2SMvfNm H4NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RVR7pUQEG31iVUA6cUrPPhiUlLhN1EKerFQpUeOEhog=; fh=BciTY8s2rKpQx3LE5IdNDgmbZcZTGEVRqj9ISahhiHM=; b=PJ4ZTBYfvF6hqy/OMKk9cpX5Ir4vALJkn3A+OSHSbMs7/gtzdlgqSkuQLL8joIhYx8 iJVN7EmEFguCwbE3x9g7lV7Th37mD97vf8e1x45Z3FmSKzKkgs+R3w0bIUANzpdKxsJL z1oNG0XDUX5rD0T8DD/gKh9iiw00vYDeZ6Eg9jxjsjRSRDLmn2fiV8kXbGo8rx5BmofX 5KpgKEPJiwZctsqJrPuLnhB7sIakMuMExh49IvvWzHsqmrMUK+YTXlk9DmtYboN0L4yc VLIXo2MuKeuG/jwAFBGCTEldiAED5CBw2LpdjB5x/UHAkFzaA4eurJvL2l2VP4lrJSaE bThA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Gd5ilIFE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id fh5-20020a056a00390500b006cbdeec441bsi11226977pfb.236.2023.12.06.02.55.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 02:55:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Gd5ilIFE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E96E880B19D0; Wed, 6 Dec 2023 02:55:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377598AbjLFKzJ (ORCPT + 99 others); Wed, 6 Dec 2023 05:55:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377508AbjLFKzH (ORCPT ); Wed, 6 Dec 2023 05:55:07 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CF4EA4; Wed, 6 Dec 2023 02:55:13 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso4302714a12.3; Wed, 06 Dec 2023 02:55:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701860113; x=1702464913; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=RVR7pUQEG31iVUA6cUrPPhiUlLhN1EKerFQpUeOEhog=; b=Gd5ilIFE4uXRWCXECZ+y9gk8maLrBJ0AdVT7ZVwx1VhCSxVjDXYd/STQMo/sP//+jG nXTx1APQtGy8/retsCSItnFgTqQMNFLJp0tul5AYfyhrKI5skEWPJVCHdVcnsIH4Y/ar G7W08bwN0CMSv9c36mWOadsxrTMD6hGGxxJhfpWEL3fI/Ivx6k2nUWtQ4lI/f89BiHzv vqlECT05LT1SmFDapcez2p6nVMCIcggjNfzlCf7gu4t4EwvuSBm2zoYogh84e9DqtRu1 W0zqoWM2CcHXhtPWC15ZmmU6ryAxXQTr+5MK+jbsR1aEsm/6AEURh1F+Qbjhe/CNJa9G HgWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701860113; x=1702464913; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RVR7pUQEG31iVUA6cUrPPhiUlLhN1EKerFQpUeOEhog=; b=c9/kabUzYPtHN2Ccap+vnYZ42GTaPEDH6ot5MlEpUezZ5zobIxGNyp3WnAQTZX6eUh V4B4yNi8ogHs2A1a3bOZUCslOR9SS1kawNqQtQBHSCPc/KVlMVjg1sTTCGSWxBohajc/ RBtjUc6s22mpx3Q4N66g4f2WWI7WrqVPrXCMyVJP0cGqNODvde5oDMS3JSvUYxLX1SCL hmAVZPBafBbwtjQBA9PksxmvgA8XR1k61pBfyHOG7wq/0vpcpXHtASlvy5rzIpXqnH/c 3AOhQ9wuwpQNhtGnaQKbOkRo1gMKzoETdRMGlb/aKV8YS2vEx7PNSr/G3ImHCExzq92E Y89Q== X-Gm-Message-State: AOJu0YyMe8XiVr555xBIPNmoDq/6/XfSgbI7u7n1yD0PBPj9KHUrVQFz E6r1nRorPLSh4NFKSisDsfs= X-Received: by 2002:a05:6a21:7891:b0:18f:e3fb:8cf2 with SMTP id bf17-20020a056a21789100b0018fe3fb8cf2mr271957pzc.84.1701860112787; Wed, 06 Dec 2023 02:55:12 -0800 (PST) Received: from archie.me ([103.131.18.64]) by smtp.gmail.com with ESMTPSA id gx4-20020a056a001e0400b006ce41b1ba8csm6153534pfb.131.2023.12.06.02.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 02:55:11 -0800 (PST) Received: by archie.me (Postfix, from userid 1000) id 4EA0210418A9B; Wed, 6 Dec 2023 17:55:09 +0700 (WIB) Date: Wed, 6 Dec 2023 17:55:09 +0700 From: Bagas Sanjaya To: Waiman Long , Tejun Heo , Zefan Li , Johannes Weiner , Andrew Morton , Michal Hocko , Frederic Weisbecker Cc: Linux CGroups , Linux Kernel Mailing List , Mrunal Patel , Ryan Phillips , Brent Rowsell , Peter Hunt , Cestmir Kalina Subject: Re: [PATCH-cgroup v2] cgroup/cpuset: Include isolated cpuset CPUs in cpu_is_isolated() check Message-ID: References: <20231205222114.773446-1-longman@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7yiVXI7aBtIVC8K1" Content-Disposition: inline In-Reply-To: <20231205222114.773446-1-longman@redhat.com> X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 06 Dec 2023 02:55:24 -0800 (PST) --7yiVXI7aBtIVC8K1 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 05, 2023 at 05:21:14PM -0500, Waiman Long wrote: > Currently, the cpu_is_isolated() function checks only the statically > isolated CPUs specified via the "isolcpus" and "nohz_full" kernel > command line options. This function is used by vmstat and memcg to > reduce interference with isolated CPUs by not doing stat flushing > or scheduling works on those CPUs. >=20 > Workloads running on isolated CPUs within isolated cpuset > partitions should receive the same treatment to reduce unnecessary > interference. This patch introduces a new cpuset_cpu_is_isolated() > function to be called by cpu_is_isolated() so that the set of dynamically > created cpuset isolated CPUs will be included in the check. >=20 > Assuming that testing a bit in a cpumask is atomic, no synchronization > primitive is currently used to synchronize access to the cpuset's > isolated_cpus mask. >=20 > Signed-off-by: Waiman Long > --- > include/linux/cpuset.h | 6 ++++++ > include/linux/sched/isolation.h | 4 +++- > kernel/cgroup/cpuset.c | 11 +++++++++++ > 3 files changed, 20 insertions(+), 1 deletion(-) >=20 > diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h > index d629094fac6e..875d12598bd2 100644 > --- a/include/linux/cpuset.h > +++ b/include/linux/cpuset.h > @@ -77,6 +77,7 @@ extern void cpuset_lock(void); > extern void cpuset_unlock(void); > extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *m= ask); > extern bool cpuset_cpus_allowed_fallback(struct task_struct *p); > +extern bool cpuset_cpu_is_isolated(int cpu); > extern nodemask_t cpuset_mems_allowed(struct task_struct *p); > #define cpuset_current_mems_allowed (current->mems_allowed) > void cpuset_init_current_mems_allowed(void); > @@ -207,6 +208,11 @@ static inline bool cpuset_cpus_allowed_fallback(stru= ct task_struct *p) > return false; > } > =20 > +static inline bool cpuset_cpu_is_isolated(int cpu) > +{ > + return false; > +} > + > static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) > { > return node_possible_map; > diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolat= ion.h > index fe1a46f30d24..2b461129d1fa 100644 > --- a/include/linux/sched/isolation.h > +++ b/include/linux/sched/isolation.h > @@ -2,6 +2,7 @@ > #define _LINUX_SCHED_ISOLATION_H > =20 > #include > +#include > #include > #include > =20 > @@ -67,7 +68,8 @@ static inline bool housekeeping_cpu(int cpu, enum hk_ty= pe type) > static inline bool cpu_is_isolated(int cpu) > { > return !housekeeping_test_cpu(cpu, HK_TYPE_DOMAIN) || > - !housekeeping_test_cpu(cpu, HK_TYPE_TICK); > + !housekeeping_test_cpu(cpu, HK_TYPE_TICK) || > + cpuset_cpu_is_isolated(cpu); > } > =20 > #endif /* _LINUX_SCHED_ISOLATION_H */ > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 2a16df86c55c..dfbb16aca9f4 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -1518,6 +1518,17 @@ static void update_unbound_workqueue_cpumask(bool = isolcpus_updated) > WARN_ON_ONCE(ret < 0); > } > =20 > +/** > + * cpuset_cpu_is_isolated - Check if the given CPU is isolated > + * @cpu: the CPU number to be checked > + * Return: true if CPU is used in an isolated partition, false otherwise > + */ > +bool cpuset_cpu_is_isolated(int cpu) > +{ > + return cpumask_test_cpu(cpu, isolated_cpus); > +} > +EXPORT_SYMBOL_GPL(cpuset_cpu_is_isolated); > + > /* > * compute_effective_exclusive_cpumask - compute effective exclusive CPUs > * @cs: cpuset No regressions when booting the kernel with this patch applied. Tested-by: Bagas Sanjaya --=20 An old man doll... just what I always wanted! - Clara --7yiVXI7aBtIVC8K1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSSYQ6Cy7oyFNCHrUH2uYlJVVFOowUCZXBTCQAKCRD2uYlJVVFO o0SOAPsGLs57YKlqeW0mamVOu9pFNmDonfvm0YtiCd+JhtIgiAD9HULH9VkRcoiO FrFVJ5r7BQXi1aof2ssYAYE2qG3UWgc= =+L7D -----END PGP SIGNATURE----- --7yiVXI7aBtIVC8K1--