public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zefan Li <lizefan@huawei.com>
To: Tejun Heo <tj@kernel.org>
Cc: "Christian Brauner" <christianvanbrauner@gmail.com>,
	"Serge Hallyn" <serge.hallyn@ubuntu.com>,
	"Stéphane Graber" <stgraber@ubuntu.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Cgroups <cgroups@vger.kernel.org>
Subject: [PATCH 1/3] cpuset: initialize effective masks when clone_children is enabled
Date: Fri, 13 Feb 2015 11:19:49 +0800	[thread overview]
Message-ID: <54DD6D55.2070603@huawei.com> (raw)

If clone_children is enabled, effective masks won't be initialized
due to the bug:

  # mount -t cgroup -o cpuset xxx /mnt
  # echo 1 > cgroup.clone_children
  # mkdir /mnt/tmp
  # cat /mnt/tmp/
  # cat cpuset.effective_cpus

  # cat cpuset.cpus
  0-15

And then this cpuset won't constrain the tasks in it.

Either the bug or the fix has no effect on unified hierarchy, as
there's no clone_chidren flag there any more.

Reported-by: Christian Brauner <christianvanbrauner@gmail.com>
Reported-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Cc: <stable@vger.kernel.org> # 3.17+
Signed-off-by: Zefan Li <lizefan@huawei.com>
---
 kernel/cpuset.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 64b257f..7e9d711 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1992,7 +1992,9 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
 
 	spin_lock_irq(&callback_lock);
 	cs->mems_allowed = parent->mems_allowed;
+	cs->effective_mems = parent->mems_allowed;
 	cpumask_copy(cs->cpus_allowed, parent->cpus_allowed);
+	cpumask_copy(cs->effective_cpus, parent->cpus_allowed);
 	spin_unlock_irq(&callback_lock);
 out_unlock:
 	mutex_unlock(&cpuset_mutex);
-- 
1.8.0.2


             reply	other threads:[~2015-02-13  3:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13  3:19 Zefan Li [this message]
2015-02-13  3:20 ` [PATCH 2/3] cpuset: fix a warning when clearing configured masks in old hierarchy Zefan Li
2015-02-13  3:21 ` [PATCH 1/3] cpuset: initialize effective masks when clone_children is enabled Zefan Li
2015-02-13  3:58 ` [PATCH 3/3] cpuset: Fix cpuset sched_relax_domain_level Zefan Li
2015-02-13  6:19 ` [PATCH 1/3] cpuset: initialize effective masks when clone_children is enabled Serge E. Hallyn
2015-03-02  6:16 ` Zefan Li
2015-03-02 16:55   ` Tejun Heo

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=54DD6D55.2070603@huawei.com \
    --to=lizefan@huawei.com \
    --cc=cgroups@vger.kernel.org \
    --cc=christianvanbrauner@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge.hallyn@ubuntu.com \
    --cc=stgraber@ubuntu.com \
    --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