From: Serge Hallyn <serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: rlove-L7G0xEPcOZbYtjvyW6yDsg@public.gmane.org,
gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
kay-tD+1rO4QERM@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
lennart-mdGvqq1h2p+GdvJs77BJ7Q@public.gmane.org,
eparis-FjpueFixGhCM4zKIHC2jIg@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
john-jueV0HHMeujJJrXXpGQQMAC/G2K4zDHf@public.gmane.org
Subject: Re: [PATCH 3/3] cgroup: implement cgroup.subtree_populated for the default hierarchy
Date: Thu, 10 Apr 2014 09:04:24 -0500 [thread overview]
Message-ID: <20140410140424.GA4481@sergelap> (raw)
In-Reply-To: <20140410130831.GA25308-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
Quoting Tejun Heo (tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org):
> Hey, Serge.
>
> On Thu, Apr 10, 2014 at 05:08:55AM +0200, Serge E. Hallyn wrote:
> > Quoting Tejun Heo (tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org):
> > > * 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.
> >
> > (Not seriously worried about this, but it's a point worth considering)
> > It does have one advantage though: if the userspace agent goes bad,
> > cgroups can still be removed on empty.
> >
> > Do you plan on keeping release-on-empty around? I assume only for a
> > while?
>
> The new mechanism is only for the unified hierarchy. The old one will
> be kept around for other hierarchies.
>
> > Do you think there is any value in having a simpler "remove-when-empty"
> > file? Doesn't call out to userspace, just drops the cgroup when there
> > are no more tasks or sub-cgroups?
>
> I don't think so. Implementing such simplistic mechanism in userland
> is trivial and even independent failover mechanisms can be easily
> implemented from userland as multiple entities can set up watches. I
> don't think there's much value in providing another mechanism from
> kernel side. The only reason why release_agent thing got as complex
> as it is is because the mechanism is fundamentally flawed - clumsy
> delivery, no multiple watches, single watch point - so people tried to
> work around it by adding event filtering from kernel side, which is
> quite backwards IMHO. With proper event mechanism, everything should
> be easily achievable from userland side.
Except for the keeping state. If the userspace agent crashes when it
was meant to drop 100 cgroups when they become empty, then when it
restarts those 100 cgroups may never be freed. Of course userspace
can do things about this, but it just seems like it would be so
trivial to handle this case in the kernel. Like you say there is
no need for all the fancy agent spawning - just notice that the
cgroup became empty, that releaseonempty was true, and so unlink the
thing. It'll be freed when anyone who has it held open closes it.
> > > * Events are filtered from the kernel side. "notify_on_release" file
> > > is used to subscribe to or suppres release event and events are not
> > > generated if a cgroup becomes empty by moving the last task out of
> > > it; however, event is generated if it becomes empty because the last
> > > child cgroup is removed. This is inconsistent, awkward and
> >
> > Hm, maybe I'm misreading but this doesn't seem right. If I move
> > a task into x1 and kill the task, x1 goes away. Likewise if I
> > create x1/y1, and rmdir y1, x1 goes away. I suspect I'm misunderstanding
> > the case in which you say it doesn't happen?
>
> The case where you move a task out of x1/y1 to another cgroup doesn't
> generate an event. One could say that that's unnecessary because the
Still confused.
If I create x1/y1 and x3/y3, set notify_on_release on x1 and x1/y1,
move a task into x1/y1, then move it to x3/y3, then x1/y1 and x1 both
do get removed.
> mover knows that the cgroup is becoming empty; however, it excludes
> any cases where there are more than one actors and the same can be
> said for cases when the actor is removing a child.
>
> > > 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 1 if there is no task in the cgroup and its
> >
> > I think you meant this backward? It's 1 if there is *any task in
> > the cgroup and its descendants, else 0?
>
> Oops, yeap. Will update.
>
> Thanks!
>
> --
> tejun
next prev parent reply other threads:[~2014-04-10 14:04 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-09 15:07 [PATCHSET cgroup/for-3.16] cgroup: implement cgroup.populated Tejun Heo
[not found] ` <1397056052-2829-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-04-09 15:07 ` [PATCH 1/3] kernfs: implement kernfs_root->supers list Tejun Heo
2014-04-09 15:07 ` [PATCH 2/3] kernfs: make kernfs_notify() trigger inotify events too Tejun Heo
2014-04-09 15:07 ` [PATCH 3/3] cgroup: implement cgroup.subtree_populated for the default hierarchy Tejun Heo
2014-04-10 3:08 ` Serge E. Hallyn
[not found] ` <20140410030855.GA29658-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2014-04-10 13:08 ` Tejun Heo
[not found] ` <20140410130831.GA25308-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-04-10 14:04 ` Serge Hallyn [this message]
2014-04-10 14:19 ` Tejun Heo
[not found] ` <20140410141957.GE25308-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-04-11 9:00 ` Li Zefan
2014-04-14 21:31 ` [PATCHSET cgroup/for-3.16] cgroup: implement cgroup.populated Tejun Heo
[not found] ` <20140414213100.GA1863-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-04-14 22:26 ` Greg KH
[not found] ` <20140414222658.GA18152-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2014-04-15 16:18 ` Tejun Heo
[not found] ` <20140415161828.GA30990-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-04-23 15:16 ` Tejun Heo
[not found] ` <20140423151638.GG4781-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-04-25 18:57 ` Greg KH
2014-04-25 22:30 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2014-04-14 21:44 [PATCHSET cgroup/for-3.16] cgroup: implement cgroup.populated, v2 Tejun Heo
[not found] ` <1397511846-2904-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-04-14 21:44 ` [PATCH 3/3] cgroup: implement cgroup.subtree_populated for the default hierarchy Tejun Heo
[not found] ` <1397511846-2904-4-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-04-15 0:57 ` Li Zefan
[not found] ` <534C83F1.9020106-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-04-15 14:54 ` Tejun Heo
[not found] ` <20140415145450.GL1863-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-04-15 16:52 ` Tejun Heo
[not found] ` <20140415165221.GD30990-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-04-16 1:30 ` Li Zefan
2014-04-16 2:48 ` Li Zefan
[not found] ` <534DEF62.4090900-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-04-16 3:33 ` Kay Sievers
[not found] ` <CAPXgP12kvPdX0QExwN2JphDfEW=d+7K2c_Y8DbomGd=YVy=VGQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-16 3:50 ` Eric W. Biederman
[not found] ` <87tx9uhr0j.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-04-16 4:15 ` Kay Sievers
2014-04-16 4:20 ` Li Zefan
2014-04-16 4:16 ` 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=20140410140424.GA4481@sergelap \
--to=serge.hallyn-gewih/nmzzlqt0dzr+alfa@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=eparis-FjpueFixGhCM4zKIHC2jIg@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=john-jueV0HHMeujJJrXXpGQQMAC/G2K4zDHf@public.gmane.org \
--cc=kay-tD+1rO4QERM@public.gmane.org \
--cc=lennart-mdGvqq1h2p+GdvJs77BJ7Q@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rlove-L7G0xEPcOZbYtjvyW6yDsg@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@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;
as well as URLs for NNTP newsgroup(s).