From: Oleg Nesterov <oleg@redhat.com>
To: Paul Menage <menage@google.com>
Cc: Ben Blum <bblum@andrew.cmu.edu>,
linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org, akpm@linux-foundation.org,
ebiederm@xmission.com, lizf@cn.fujitsu.com, matthltc@us.ibm.com
Subject: Re: [RFC] [PATCH 2/2] cgroups: make procs file writable
Date: Wed, 2 Jun 2010 16:06:59 +0200 [thread overview]
Message-ID: <20100602140659.GA5324@redhat.com> (raw)
In-Reply-To: <AANLkTimcrX0TjzDMNJdubR92pAO4IPATbVpyvvVt0qIV@mail.gmail.com>
On 06/01, Paul Menage wrote:
>
> On Mon, May 31, 2010 at 11:04 AM, Oleg Nesterov <oleg@redhat.com> wrote:
> >
> > And, forgot to mention, I do not understand the PF_EXITING check in
> > attach_task_by_pid() (and some others).
> >
> > At first glance, it buys nothing. PF_EXITING can be set right after
> > the check.
>
> It can, but it's a benign race.
Yes,
> Moving a non-current thread into a cgroup takes task->alloc_lock and
> checks for PF_EXITING before manipulating that thread's cgroup links.
> The exit procedure sets PF_EXITING and then (somewhat later, but
> guaranteed) moves current to the root cgroups while holding
> alloc_lock.
Yes sure, I understand this part. cgroup_attach_task() correctly checks
PF_EXITING under task_lock(), this protects from the case when this
task has already passed cgroup_exit() which takes this lock too.
But. This exactly means that the PF_EXITING check in attach_task_by_pid()
is not necessary from the correctness pov (while probably can be considered
as optimization), right?
And,
> so it's fine to refuse to move it to a new cgroup.
I am not sure. It doesn't hurt when we try to move a thread. But if
we want to move the whole thread group, we should proceed even if the
group leader has already exited and thus has PF_EXITING bit set.
That was my question.
Oleg.
next prev parent reply other threads:[~2010-06-02 14:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-30 1:30 [RFC] [PATCH v2 0/2] cgroups: implement moving a threadgroup's threads atomically with cgroup.procs Ben Blum
2010-05-30 1:31 ` [RFC] [PATCH 1/2] cgroups: read-write lock CLONE_THREAD forking per threadgroup Ben Blum
2010-05-30 1:33 ` [RFC] [PATCH 2/2] cgroups: make procs file writable Ben Blum
2010-05-31 17:52 ` Oleg Nesterov
2010-05-31 18:04 ` Oleg Nesterov
2010-06-01 18:57 ` Paul Menage
2010-06-02 14:06 ` Oleg Nesterov [this message]
2010-06-02 19:53 ` Paul Menage
2010-06-02 20:20 ` Oleg Nesterov
2010-06-02 20:31 ` Paul Menage
2010-06-02 20:58 ` Oleg Nesterov
2010-06-02 21:12 ` Paul Menage
2010-06-02 21:38 ` Oleg Nesterov
2010-06-02 22:03 ` Paul Menage
2010-06-03 4:44 ` Ben Blum
2010-06-03 4:40 ` Ben Blum
2010-06-03 14:48 ` Oleg Nesterov
2010-06-03 4:56 ` Ben Blum
2010-06-03 14:43 ` Oleg Nesterov
[not found] <200908202114.n7KLEN5H026646@imap1.linux-foundation.org>
2009-08-21 10:26 ` + cgroups-add-functionality-to-read-write-lock-clone_thread-forking-pe r-threadgroup.patch added to -mm tree Oleg Nesterov
2009-08-21 10:45 ` Oleg Nesterov
2009-08-21 23:37 ` Paul Menage
2009-08-22 13:09 ` Oleg Nesterov
2010-01-03 19:06 ` Ben Blum
2010-01-03 19:09 ` [RFC] [PATCH 2/2] cgroups: make procs file writable Ben Blum
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=20100602140659.GA5324@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bblum@andrew.cmu.edu \
--cc=containers@lists.linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=matthltc@us.ibm.com \
--cc=menage@google.com \
/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).