Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751734AbbBMGTK (ORCPT ); Fri, 13 Feb 2015 01:19:10 -0500 Received: from h2.hallyn.com ([78.46.35.8]:51466 "EHLO h2.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751327AbbBMGTG (ORCPT ); Fri, 13 Feb 2015 01:19:06 -0500 Date: Fri, 13 Feb 2015 07:19:02 +0100 From: "Serge E. Hallyn" To: Zefan Li Cc: Tejun Heo , Christian Brauner , Serge Hallyn , =?iso-8859-1?Q?St=E9phane?= Graber , LKML , Cgroups Subject: Re: [PATCH 1/3] cpuset: initialize effective masks when clone_children is enabled Message-ID: <20150213061902.GA26332@mail.hallyn.com> References: <54DD6D55.2070603@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54DD6D55.2070603@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2039 Lines: 60 Quoting Zefan Li (lizefan@huawei.com): > 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 > Reported-by: Serge Hallyn Thanks - this give sme the correct output in /proc/self/status and cpuest.cpus. (I didn't do a stress test but that seems unlikely to be broken) Tested-by: Serge Hallyn > Cc: # 3.17+ > Signed-off-by: Zefan Li > --- > 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 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/