mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Glauber Costa <glommer@parallels.com>
Cc: Tejun Heo <tj@kernel.org>,
	linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, cgroups@vger.kernel.org,
	Li Zefan <lizefan@huawei.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Paul Turner <pjt@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>, Thomas Graf <tgraf@suug.ch>,
	"Serge E. Hallyn" <serue@us.ibm.com>,
	Vivek Goyal <vgoyal@redhat.com>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Neil Horman <nhorman@tuxdriver.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: Re: [PATCH REPOST RFC cgroup/for-3.7] cgroup: mark subsystems with broken hierarchy support and whine if cgroups are nested for them
Date: Wed, 12 Sep 2012 17:49:07 +0200	[thread overview]
Message-ID: <20120912154907.GW21579@dhcp22.suse.cz> (raw)
In-Reply-To: <5050568B.9090601@parallels.com>

On Wed 12-09-12 13:31:55, Glauber Costa wrote:
> On 09/11/2012 02:04 PM, Michal Hocko wrote:
> > I like the approach in general but see the comments bellow:
> > 
> > On Mon 10-09-12 15:33:55, Tejun Heo wrote:
> > [...]
> >> --- a/mm/memcontrol.c
> >> +++ b/mm/memcontrol.c
> >> @@ -3855,12 +3855,17 @@ static int mem_cgroup_hierarchy_write(st
> >>  	 */
> >>  	if ((!parent_memcg || !parent_memcg->use_hierarchy) &&
> >>  				(val == 1 || val == 0)) {
> >> -		if (list_empty(&cont->children))
> >> +		if (list_empty(&cont->children)) {
> >>  			memcg->use_hierarchy = val;
> >> -		else
> >> +			/* we're fully hierarchical iff root uses hierarchy */
> >> +			if (mem_cgroup_is_root(memcg))
> >> +				mem_cgroup_subsys.broken_hierarchy = !val;
> >> +		} else {
> >>  			retval = -EBUSY;
> >> -	} else
> >> +		}
> >> +	} else {
> >>  		retval = -EINVAL;
> >> +	}
> >>  
> >>  out:
> >>  	cgroup_unlock();
> >> @@ -4953,6 +4958,7 @@ mem_cgroup_create(struct cgroup *cont)
> >>  						&per_cpu(memcg_stock, cpu);
> >>  			INIT_WORK(&stock->work, drain_local_stock);
> >>  		}
> >> +		mem_cgroup_subsys.broken_hierarchy = !memcg->use_hierarchy;
> > 
> > Hmmm, this will warn even if we have
> > root (default use_hierarchy=0)
> >  \
> >   A (use_hierarchy=1)
> >    \
> >     B <- here
> > 
> > which is unfortunate because it will add a noise to a reasonable
> > configuration.
> > I think this is fixable if you move the warning after 
> > cgroup_subsys_state::create and broken_hierarchy would be set only if
> > parent is not root and use_hierarchy==0 in mem_cgroup_create. Something
> > like:
> > 
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 795e525..d5c93ab 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -4973,6 +4973,13 @@ mem_cgroup_create(struct cgroup *cont)
> >  	} else {
> >  		res_counter_init(&memcg->res, NULL);
> >  		res_counter_init(&memcg->memsw, NULL);
> > +		/*
> > +		 * Deeper hierachy with use_hierarchy == false doesn't make
> > +		 * much sense so let cgroup subsystem know about this unfortunate
> > +		 * state in our controller.
> > +		 */
> > +		if (parent && parent != root_mem_cgroup)
> > +			mem_cgroup_subsys.broken_hierarchy = true;
> >  	}
> >  	memcg->last_scanned_node = MAX_NUMNODES;
> >  	INIT_LIST_HEAD(&memcg->oom_notify);
> > 
> > What do you think?
> > 
> I side with Tejun's original intentions.
> 
> While I respect your goal of not warning about any configuration
> with max_level = 1, I believe the only sane configuration as soon
> as we get any 2nd-level child is use_hierarchy = 1 for everybody.
> 
> Everything aside from it should be warned.

Defintely. And that what the above guarantess, doesn't it?

-- 
Michal Hocko
SUSE Labs

  parent reply	other threads:[~2012-09-12 15:49 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-10 22:31 [PATCH " Tejun Heo
2012-09-10 22:33 ` [PATCH REPOST " Tejun Heo
2012-09-11 10:04   ` Michal Hocko
2012-09-11 17:07     ` Tejun Heo
2012-09-12 15:47       ` Michal Hocko
2012-09-12 16:41         ` Tejun Heo
     [not found]     ` <5050568B.9090601@parallels.com>
2012-09-12 15:49       ` Michal Hocko [this message]
2012-09-12 17:11         ` Tejun Heo
2012-09-13 12:14           ` Michal Hocko
2012-09-13 17:18             ` Tejun Heo
2012-09-13 17:39               ` Michal Hocko
     [not found]                 ` <5052E87A.1050405@parallels.com>
2012-09-14 19:15                   ` Tejun Heo
     [not found]           ` <5051CB24.4010801@parallels.com>
2012-09-13 17:21             ` Tejun Heo
2012-09-11 12:38   ` Li Zefan
2012-09-11 17:08     ` Tejun Heo
2012-09-11 17:43       ` Tejun Heo
     [not found]         ` <505057D8.4010908@parallels.com>
2012-09-12 16:34           ` Tejun Heo
2012-09-13  6:48             ` Li Zefan
2012-09-11 18:23   ` [PATCH UPDATED " Tejun Heo
2012-09-11 20:50     ` Aristeu Rozanski
2012-09-11 20:51       ` Tejun Heo
2012-09-13 12:16   ` [PATCH REPOST " Daniel P. Berrange
2012-09-13 17:52     ` Tejun Heo
2012-09-11 14:51 ` [PATCH " Vivek Goyal
2012-09-11 14:54   ` Vivek Goyal
2012-09-11 17:16   ` Tejun Heo
2012-09-11 17:35     ` Vivek Goyal
2012-09-11 17:55       ` Tejun Heo
2012-09-11 18:16         ` Vivek Goyal
2012-09-11 18:22           ` Tejun Heo
2012-09-11 18:38             ` Vivek Goyal
     [not found]         ` <50505C39.1050600@parallels.com>
2012-09-12 17:09           ` Tejun Heo
2012-09-13 14:53             ` Block IO controller hierarchy suppport (Was: Re: [PATCH RFC cgroup/for-3.7] cgroup: mark subsystems with broken hierarchy support and whine if cgroups are nested for them) Vivek Goyal
2012-09-13 22:06               ` Tejun Heo
2012-09-14  2:53                 ` Vivek Goyal
     [not found]                   ` <5052E8DA.1000106@parallels.com>
2012-09-14 13:22                     ` Vivek Goyal
     [not found]             ` <5051CBAA.5040308@parallels.com>
2012-09-13 17:54               ` [PATCH RFC cgroup/for-3.7] cgroup: mark subsystems with broken hierarchy support and whine if cgroups are nested for them Tejun Heo
     [not found]                 ` <5052E931.8000007@parallels.com>
2012-09-14 18:56                   ` Tejun Heo
     [not found] ` <505055E5.90903@parallels.com>
2012-09-12 17:03   ` Tejun Heo
     [not found]     ` <5051C954.2080600@parallels.com>
2012-09-13 17:48       ` Tejun Heo
     [not found]         ` <5052E9BC.2020908@parallels.com>
2012-09-17  7:59           ` Daniel Wagner

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=20120912154907.GW21579@dhcp22.suse.cz \
    --to=mhocko@suse.cz \
    --cc=acme@ghostprotocols.net \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=cgroups@vger.kernel.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=glommer@parallels.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mingo@redhat.com \
    --cc=nhorman@tuxdriver.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=serue@us.ibm.com \
    --cc=tgraf@suug.ch \
    --cc=tj@kernel.org \
    --cc=vgoyal@redhat.com \
    /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

all inboxes | Powered by JetHome®