From: "Michal Koutný" <mkoutny-IBi9RG/b67k@public.gmane.org>
To: Suren Baghdasaryan <surenb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
Topi Miettinen <toiwoton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
cgroups mailinglist
<cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
security-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org,
Security Officers
<security-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Lennart Poettering
<lennart-mdGvqq1h2p+GdvJs77BJ7Q@public.gmane.org>,
Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"Eric W. Biederman"
<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>,
james.hsu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
linger.lee-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
Tom Cherry <tomcherry-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Roman Gushchin <guro-b10kYP2dOMg@public.gmane.org>
Subject: Re: [PATCH 3/3 cgroup/for-5.2-fixes] cgroup: Include dying leaders with live threads in PROCS iterations
Date: Sat, 11 Jan 2020 00:16:24 +0100 [thread overview]
Message-ID: <20200110231624.GA6557@blackbook> (raw)
In-Reply-To: <CAJuCfpGkAsmp5B=fNz38fLE8pYaMCG=uLDSSBFByNOtWD20zVQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2513 bytes --]
Hello Suren.
On Fri, Jan 10, 2020 at 01:47:19PM -0800, Suren Baghdasaryan <surenb@google.com> wrote:
> > On Fri, Jun 07, 2019 at 07:09:53PM +0200, Michal Koutný wrote:
> > > Wouldn't it make more sense to call
> > > css_set_move_task(tsk, cset, NULL, false);
> > > in cgroup_release instead of cgroup_exit then?
> > >
> > > css_set_move_task triggers the cgroup emptiness notification so if we
> > > list group leaders with running siblings as members of the cgroup (IMO
> > > correct), is it consistent to deliver the (un)populated event
> > > that early?
> > > By moving to cgroup_release we would also make this notification
> > > analogous to SIGCHLD delivery.
> >
> > So, the current behavior is mostly historical and I don't think this
> > is a better behavior. That said, I'm not sure about the cost benefit
> > ratio of changing the behavior at this point given how long the code
> > has been this way. Another aspect is that it'd expose zombie tasks
> > and possibly migrations of them to each controller.
>
> Sorry for reviving an old discussion
Since you reply to my remark, I have to share that I found myself wrong
later wrt the emptiness notifications. Moving the task in cgroup_exit
doesn't matter if thread group contains other live tasks, the unpopulated
notification will be raised when the last task of thread group calls
group_exit, i.e. it is similar to SIGHLD.
Now to your issue.
> but I got a bug report from a customer about Android
What kernel version is that? Can be it considered equal to the current
Linux?
> In my testing I was able to reproduce the failure in
> which case rmdir() fails with EBUSY from cgroup_destroy_locked()
> because cgroup_is_populated() returns true.
That'd mean that not all tasks in the cgroup did exit() (cgroup_exit()),
i.e. they're still running. Can you see them in cgroup.threads/tasks?
> cgroup_is_populated() depends on cgrp->nr_populated_xxx counters which
> IIUC will not be updated until cgroup_update_populated() is called
> from cgroup_exit() and that might get delayed...
Why do you think it's delayed?
> So from user space's point of view the cgroup is empty and can be
> removed but rmdir() fails to do so.
As Tejun says, cgroup with only dead _tasks_ should be removable (and if
I'm not mistaken it is in the current kernel). Unless you do individual
threads migration when a thread would be separated from its (dead)
leader. Does your case include such migrations?
Michal
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-01-10 23:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87blznagrl.fsf@xmission.com>
[not found] ` <1956727d-1ee8-92af-1e00-66ae4921b075@gmail.com>
[not found] ` <87zhn6923n.fsf@xmission.com>
[not found] ` <e407a8e7-7780-f08f-320a-a0f2c954d253@gmail.com>
[not found] ` <20190529003601.GN374014@devbig004.ftw2.facebook.com>
[not found] ` <e45d974b-5eff-f781-291f-ddf5e9679e4c@gmail.com>
[not found] ` <20190530183556.GR374014@devbig004.ftw2.facebook.com>
[not found] ` <20190530183637.GS374014@devbig004.ftw2.facebook.com>
[not found] ` <20190530183700.GT374014@devbig004.ftw2.facebook.com>
[not found] ` <20190607170952.GE30727@blackbody.suse.cz>
[not found] ` <20190611185742.GH3341036@devbig004.ftw2.facebook.com>
[not found] ` <20190611185742.GH3341036-LpCCV3molIbIZ9tKgghJQw2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2020-01-10 21:47 ` [PATCH 3/3 cgroup/for-5.2-fixes] cgroup: Include dying leaders with live threads in PROCS iterations Suren Baghdasaryan
[not found] ` <CAJuCfpGkAsmp5B=fNz38fLE8pYaMCG=uLDSSBFByNOtWD20zVQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-01-10 21:56 ` Tejun Heo
[not found] ` <20200110215648.GC2677547-LpCCV3molIbIZ9tKgghJQw2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2020-01-10 22:14 ` Suren Baghdasaryan
[not found] ` <CAJuCfpHPRfV5KDM74JtDepdUJ2G+-3-A3XV+Fzr3Lkbj9nR-Cg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-01-10 22:15 ` Tejun Heo
[not found] ` <20200110221553.GD2677547-LpCCV3molIbIZ9tKgghJQw2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2020-01-10 22:50 ` Suren Baghdasaryan
2020-01-10 23:16 ` Michal Koutný [this message]
2020-01-11 0:00 ` Suren Baghdasaryan
[not found] ` <CAJuCfpG-sn0wPM9GRnCjrmytf=mDC3smsRRd=XQBLAK6ZKoAUA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-01-11 0:55 ` Suren Baghdasaryan
[not found] ` <CAJuCfpFeiH_8MbX3qeAKCz_z+XXYp9M2KrnkOsBoN5jGoV7=eg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-01-16 4:26 ` Suren Baghdasaryan
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=20200110231624.GA6557@blackbook \
--to=mkoutny-ibi9rg/b67k@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=guro-b10kYP2dOMg@public.gmane.org \
--cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
--cc=james.hsu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=lennart-mdGvqq1h2p+GdvJs77BJ7Q@public.gmane.org \
--cc=linger.lee-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=security-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org \
--cc=security-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=surenb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=toiwoton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=tomcherry-hpIqsD4AKlfQT0dZR+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