From: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>,
"Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Paul Mackerras <paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
"Aneesh Kumar K.V"
<aneesh.kumar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
Arnaldo Carvalho de Melo
<acme-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>,
Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
Thomas Graf <tgraf-G/eBtMaohhA@public.gmane.org>,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Paul Turner <pjt-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Vivek Goyal <vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH cgroup/for-3.7] cgroup: mark subsystems with broken hierarchy support and whine if cgroups are nested for them
Date: Thu, 13 Sep 2012 20:46:53 +0200 [thread overview]
Message-ID: <20120913184653.GA22529@dhcp22.suse.cz> (raw)
In-Reply-To: <20120913183402.GG7677-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
On Thu 13-09-12 11:34:02, Tejun Heo wrote:
[...]
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -4075,8 +4075,18 @@ static long cgroup_create(struct cgroup
> set_bit(CGRP_CLONE_CHILDREN, &cgrp->flags);
>
> for_each_subsys(root, ss) {
> - struct cgroup_subsys_state *css = ss->create(cgrp);
> + struct cgroup_subsys_state *css;
> +
> + if (ss->broken_hierarchy && !ss->warned_broken_hierarchy &&
> + parent->parent) {
> + pr_warning("cgroup: %s (%d) created nested cgroup for controller \"%s\" which has incomplete hierarchy support. Nested cgroups may change behavior in the future.\n",
> + current->comm, current->pid, ss->name);
> + if (!strcmp(ss->name, "memory"))
> + pr_warning("cgroup: \"memory\" requires setting use_hierarchy to 1 on the root.\n");
> + ss->warned_broken_hierarchy = true;
> + }
>
> + css = ss->create(cgrp);
As I said in other email. We have to move the warning after the create
callback or you will not give any chance to the controller to say
whether broken_hierarchy is really the case here.
[...]
> --- 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;
This is not necessary because mem_cgroup_create will take care of the
proper broken_hierarchy setting.
> + } else {
> retval = -EBUSY;
> - } else
> + }
> + } else {
> retval = -EINVAL;
> + }
>
> out:
> cgroup_unlock();
> @@ -4973,6 +4978,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;
This should be sufficient.
> }
> memcg->last_scanned_node = MAX_NUMNODES;
> INIT_LIST_HEAD(&memcg->oom_notify);
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2012-09-13 18:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-13 18:34 [PATCH cgroup/for-3.7] cgroup: mark subsystems with broken hierarchy support and whine if cgroups are nested for them Tejun Heo
[not found] ` <20120913183402.GG7677-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-09-13 18:46 ` Michal Hocko [this message]
2012-09-13 19:20 ` [PATCH v4 " Tejun Heo
[not found] ` <20120913192058.GH7677-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-09-13 19:27 ` Michal Hocko
2012-09-13 19:41 ` Vivek Goyal
[not found] ` <20120913194111.GM4396-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-09-13 20:03 ` Tejun Heo
[not found] ` <20120913200354.GN7677-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-09-13 20:17 ` Vivek Goyal
2012-09-14 9:14 ` Glauber Costa
[not found] ` <5052F58E.4050808-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-09-14 9:17 ` Glauber Costa
[not found] ` <5052F61A.3040602-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-09-14 21:06 ` Tejun Heo
2012-09-14 4:55 ` Serge Hallyn
2012-09-14 7:48 ` Li Zefan
2012-09-14 9:11 ` Glauber Costa
2012-09-14 19:06 ` Tejun Heo
[not found] ` <20120914190608.GM17747-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-09-18 15:04 ` Michal Hocko
[not found] ` <20120918150404.GC19840-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2012-09-18 16:27 ` Tejun Heo
[not found] ` <CAOS58YPjEE-+Kak_XidAd5qT84pZKt_z=4_MXadHYvzP+yZ5+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-18 16:33 ` Michal Hocko
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=20120913184653.GA22529@dhcp22.suse.cz \
--to=mhocko-alswssmvlrq@public.gmane.org \
--cc=acme-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org \
--cc=aneesh.kumar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
--cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
--cc=paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
--cc=pjt-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
--cc=tgraf-G/eBtMaohhA@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.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