[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <534C83F1.9020106@huawei.com>
Date: Tue, 15 Apr 2014 08:57:21 +0800
From: Li Zefan <lizefan@...wei.com>
To: Tejun Heo <tj@...nel.org>
CC: <containers@...ts.linux-foundation.org>, <cgroups@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <john@...nmccutchan.com>,
<rlove@...ve.org>, <eparis@...isplace.org>,
<gregkh@...uxfoundation.org>, <serge.hallyn@...ntu.com>,
<lennart@...ttering.net>, <kay@...y.org>
Subject: Re: [PATCH 3/3] cgroup: implement cgroup.subtree_populated for the
default hierarchy
On 2014/4/15 5:44, Tejun Heo wrote:
> cgroup users often need a way to determine when a cgroup's
> subhierarchy becomes empty so that it can be cleaned up. cgroup
> currently provides release_agent for it; unfortunately, this mechanism
> is riddled with issues.
>
> * It delivers events by forking and execing a userland binary
> specified as the release_agent. This is a long deprecated method of
> notification delivery. It's extremely heavy, slow and cumbersome to
> integrate with larger infrastructure.
>
> * There is single monitoring point at the root. There's no way to
> delegate management of subtree.
>
> * The event isn't recursive. It triggers when a cgroup doesn't have
> any tasks or child cgroups. Events for internal nodes trigger only
> after all children are removed. This again makes it impossible to
> delegate management of subtree.
>
> * Events are filtered from the kernel side. "notify_on_release" file
> is used to subscribe to or suppress release event. This is
> unnecessarily complicated and probably done this way because event
> delivery itself was expensive.
>
> This patch implements interface file "cgroup.subtree_populated" which
> can be used to monitor whether the cgroup's subhierarchy has tasks in
> it or not. Its value is 0 if there is no task in the cgroup and its
> descendants; otherwise, 1,
Is cgroup.tree_populated a better name?
cgroup.subtree_control controls child cgroups only, but .subtree_populated
shows 1 if there're tasks in the cgroup or its children, so the two
are a bit inconsistent to me.
> and kernfs_notify() notificaiton is
> triggers when the value changes, which can be monitored through poll
> and [di]notify.
>
> This is a lot ligther and simpler and trivially allows delegating
> management of subhierarchy - subhierarchy monitoring can block further
> propgation simply by putting itself or another process in the root of
> the subhierarchy and monitor events that it's interested in from there
> without interfering with monitoring higher in the tree.
>
> v2: Patch description updated as per Serge.
>
> Signed-off-by: Tejun Heo <tj@...nel.org>
> Acked-by: Serge Hallyn <serge.hallyn@...ntu.com>
> Cc: Lennart Poettering <lennart@...ttering.net>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists