From: Li Zefan <lizefan@huawei.com>
To: Tejun Heo <tj@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Cgroups <cgroups@vger.kernel.org>
Subject: Re: [PATCH 2/3] cgroup: make the default root invisible when it's umounted
Date: Wed, 4 Jun 2014 16:59:59 +0800 [thread overview]
Message-ID: <538EE00F.10406@huawei.com> (raw)
In-Reply-To: <20140603130144.GB26210@htj.dyndns.org>
On 2014/6/3 21:01, Tejun Heo wrote:
> On Tue, Jun 03, 2014 at 12:05:22PM +0800, Li Zefan wrote:
>> Before this patch (in a fresh system):
>>
>> # cat /proc/$$/cgroup
>> # mount -t cgroup -o __DEVEL__sane_behavior xxx /cgroup
>> # umount /cgroup
>> # cat /proc/$$/cgroup
>> 0:cpuset,cpu,cpuacct,memory,devices,freezer,net_cls,blkio,perf_event,net_prio,hugetlb:/
>>
>> After this patch (in a fresh system):
>>
>> # cat ...
>> # mount ...
>> # umount ...
>> # cat /proc/$$/cgroup
>> #
>>
>> You won't see the default root after it's umounted.
>
> Hmmmm... I intentionally left it visible tho. The only reason we gate
> its visibility is avoid disturbing userland which doesn't know about
> and won't use the unified hierarchy. If the userland starts making
> use of it, there's no reason to hide it again especially as that's
> consistent with how other hierarchies behave too - they keep showing
> up if they have lingering refs.
>
The example I gave is the same result if sane_behavior is not specified,
so this is a behavioural change for the old interface?
Do we need a fix like this?
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 3f46165..6f10cff 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1789,6 +1789,9 @@ static void cgroup_kill_sb(struct super_block *sb)
else
percpu_ref_kill(&root->cgrp.self.refcnt);
+ if (root == &cgrp_dfl_root && !cgroup_sane_behavior(&root->cgrp))
+ cgrp_dfl_root_visible = false;
+
kernfs_kill_sb(sb);
next prev parent reply other threads:[~2014-06-04 9:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-03 4:04 [PATCH 1/3] cgroup: don't destroy the default root Li Zefan
2014-06-03 4:05 ` [PATCH 2/3] cgroup: make the default root invisible when it's umounted Li Zefan
2014-06-03 13:01 ` Tejun Heo
2014-06-04 8:59 ` Li Zefan [this message]
2014-06-05 1:20 ` Tejun Heo
2014-06-05 1:49 ` Li Zefan
2014-06-03 4:05 ` [PATCH 3/3] cgroup: set visible flag only after we've mounted the default root Li Zefan
2014-06-03 13:02 ` Tejun Heo
2014-06-03 12:57 ` [PATCH 1/3] cgroup: don't destroy " Tejun Heo
2014-06-04 8:40 ` Li Zefan
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=538EE00F.10406@huawei.com \
--to=lizefan@huawei.com \
--cc=cgroups@vger.kernel.org \
--cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).