BPF List
 help / color / mirror / Atom feed
From: Chen Ridong <chenridong@huawei.com>
To: <tj@kernel.org>, <lizefan.x@bytedance.com>, <hannes@cmpxchg.org>,
	<longman@redhat.com>, <adityakali@google.com>,
	<sergeh@kernel.org>
Cc: <bpf@vger.kernel.org>, <cgroups@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH -next] cgroup/cpuset: Do not clear xcpus when clearing cpus
Date: Wed, 31 Jul 2024 09:21:02 +0000	[thread overview]
Message-ID: <20240731092102.2369580-1-chenridong@huawei.com> (raw)

After commit 737bb142a00d ("cgroup/cpuset: Make cpuset.cpus.exclusive
independent of cpuset.cpus"), cpuset.cpus.exclusive and cpuset.cpus
became independent. However we found that cpuset.cpus.exclusive.effective
is cleared when cpuset.cpus is clear. To fix this issue, just remove xcpus
clearing when cpuset.cpus is being cleared.

It can be reproduced as below:
cd /sys/fs/cgroup/
mkdir test
echo +cpuset > cgroup.subtree_control
cd test
echo 3 > cpuset.cpus.exclusive
cat cpuset.cpus.exclusive.effective
3
echo > cpuset.cpus
cat cpuset.cpus.exclusive.effective // was cleared

Signed-off-by: Chen Ridong <chenridong@huawei.com>
---
 kernel/cgroup/cpuset.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index a9b6d56eeffa..248c39bebbe9 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2523,10 +2523,9 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
 	 * that parsing.  The validate_change() call ensures that cpusets
 	 * with tasks have cpus.
 	 */
-	if (!*buf) {
+	if (!*buf)
 		cpumask_clear(trialcs->cpus_allowed);
-		cpumask_clear(trialcs->effective_xcpus);
-	} else {
+	else {
 		retval = cpulist_parse(buf, trialcs->cpus_allowed);
 		if (retval < 0)
 			return retval;
-- 
2.34.1


             reply	other threads:[~2024-07-31  9:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31  9:21 Chen Ridong [this message]
2024-08-01  3:22 ` [PATCH -next] cgroup/cpuset: Do not clear xcpus when clearing cpus Waiman Long
2024-08-01 16:31   ` Waiman Long
2024-08-09 18:51     ` Saket Kumar Bhaskar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240731092102.2369580-1-chenridong@huawei.com \
    --to=chenridong@huawei.com \
    --cc=adityakali@google.com \
    --cc=bpf@vger.kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=longman@redhat.com \
    --cc=sergeh@kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox