From: Oleg Nesterov <oleg@redhat.com>
To: Tejun Heo <htejun@gmail.com>
Cc: rjw@sisk.pl, paul@paulmenage.org, lizf@cn.fujitsu.com,
linux-pm@lists.linux-foundation.org,
linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org, fweisbec@gmail.com,
matthltc@us.ibm.com, akpm@linux-foundation.org,
Paul Menage <menage@google.com>, Ben Blum <bblum@andrew.cmu.edu>
Subject: Re: [PATCH 3/4] threadgroup: extend threadgroup_lock() to cover exit and exec
Date: Wed, 12 Oct 2011 19:51:04 +0200 [thread overview]
Message-ID: <20111012175104.GA6156@redhat.com> (raw)
In-Reply-To: <20111010171105.GE8100@google.com>
Hi,
On 10/10, Tejun Heo wrote:
>
> Hope you can still remember some
> of this one. :)
I am not sure ;)
> On Sun, Sep 18, 2011 at 07:37:23PM +0200, Oleg Nesterov wrote:
> > > With this change, threadgroup_lock() guarantees that the target
> > > threadgroup will remain stable - no new task will be added, no new
> > > PF_EXITING will be set and exec won't happen.
> >
> > To me, this is the only "contradictory" change,
>
> What do you mean "contradictory"? Can you please elaborate?
Because, iirc, with this patch do_exit() does (almost) everything
under rw_sem. OK, down_read() should be cheap, but still.
See also below.
> > > + /*
> > > + * Release threadgroup and make sure we are holding no locks.
> > > + */
> > > + threadgroup_change_done(tsk);
> >
> > I am wondering, can't we narrow the scope of threadgroup_change_begin/done
> > in do_exit() path?
> >
> > The code after 4/4 still has to check PF_EXITING, this is correct. And yes,
> > with this patch PF_EXITING becomes stable under ->group_rwsem. But, it seems,
> > we do not really need this?
> >
> > I mean, can't we change cgroup_exit() to do threadgroup_change_begin/done
> > instead? We do not really care about PF_EXITING, we only need to ensure that
> > we can't race with cgroup_exit(), right?
>
> If we confine our usage to cgroup, excluding just against
> cgroup_exit() might work although this is still a bit nasty. ie. some
> callbacks might not expect half torn-down tasks in methods other than
> the exit callback.
Oh, sorry, I don't understand... I already forgot the details.
> Also, it makes the mechanism unnecessarily cgroup-specific without
> gaining much if anything.
Yes! And _personally_ I think it should be cgroup-specific, that is
why I dislike the very fact do_exit() uses it directly. To me it would
be cleaner to shift it into cgroup hooks. Yes, sure, this is subjective.
In fact I still hope we can kill this sem altogether, but so far I have
no idea how we can do this. We do need the new per-process lock to
protect (in particular) ->thread_group. It is quite possible that it
should be rw_semaphore. But in this case we down_write(), not _read
in exit/fork paths, and its scope should be small.
I do not think the current lock should have more users. Of course I
can be wrong. And what exactly it protects? I mean copy_process().
Almost everything, but this simply connects to cgroup fork hooks.
Just my opinion, I am not going to insist.
Oleg.
next prev parent reply other threads:[~2011-10-12 17:55 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-04 18:01 [PATCHSET cgroup] extend threadgroup locking Tejun Heo
2011-09-04 18:01 ` [PATCH 1/4] cgroup: change locking order in attach_task_by_pid() Tejun Heo
2011-09-04 18:01 ` Tejun Heo
2011-09-18 18:56 ` Oleg Nesterov
2011-10-10 17:34 ` Tejun Heo
2011-10-10 17:43 ` Tejun Heo
2011-09-04 18:01 ` [PATCH 2/4] threadgroup: rename signal->threadgroup_fork_lock to ->group_rwsem Tejun Heo
2011-09-04 18:01 ` Tejun Heo
2011-09-04 18:01 ` [PATCH 3/4] threadgroup: extend threadgroup_lock() to cover exit and exec Tejun Heo
2011-09-04 18:01 ` Tejun Heo
2011-09-12 4:04 ` Paul Menage
2011-09-13 7:54 ` Tejun Heo
2011-09-18 17:37 ` Oleg Nesterov
2011-09-18 18:46 ` Oleg Nesterov
2011-10-08 18:37 ` Ben Blum
2011-10-10 17:11 ` Tejun Heo
2011-10-12 17:51 ` Oleg Nesterov [this message]
2011-10-12 18:05 ` Ben Blum
2011-10-12 18:29 ` Oleg Nesterov
2011-10-12 18:44 ` Ben Blum
2011-10-12 19:07 ` Oleg Nesterov
2011-09-04 18:01 ` [PATCH 4/4] cgroup: always lock threadgroup during migration Tejun Heo
2011-09-04 18:01 ` Tejun Heo
2011-09-18 17:41 ` Oleg Nesterov
2011-10-10 17:31 ` Tejun Heo
2011-09-05 4:05 ` [PATCHSET cgroup] extend threadgroup locking Rafael J. Wysocki
2011-09-05 4:05 ` Rafael J. Wysocki
2011-09-05 8:43 ` Tejun Heo
[not found] ` <201109050605.57360.rjw-KKrjLPT3xs0@public.gmane.org>
2011-09-05 8:43 ` Tejun Heo
2011-09-05 8:43 ` Tejun Heo
2011-09-06 9:00 ` Li Zefan
2011-09-06 9:00 ` Li Zefan
2011-09-11 3:35 ` Tejun Heo
2011-09-14 18:33 ` Oleg Nesterov
2011-09-14 23:33 ` Tejun Heo
[not found] ` <1315159280-25032-1-git-send-email-htejun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-09-04 18:01 ` [PATCH 1/4] cgroup: change locking order in attach_task_by_pid() Tejun Heo
2011-09-04 18:01 ` [PATCH 2/4] threadgroup: rename signal->threadgroup_fork_lock to ->group_rwsem Tejun Heo
2011-09-04 18:01 ` [PATCH 3/4] threadgroup: extend threadgroup_lock() to cover exit and exec Tejun Heo
2011-09-04 18:01 ` [PATCH 4/4] cgroup: always lock threadgroup during migration Tejun Heo
2011-09-05 4:05 ` [PATCHSET cgroup] extend threadgroup locking Rafael J. Wysocki
2011-09-06 9:00 ` Li Zefan
2011-09-11 3:35 ` Tejun Heo
2011-09-11 3:35 ` Tejun Heo
2011-09-12 4:11 ` Paul Menage
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=20111012175104.GA6156@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bblum@andrew.cmu.edu \
--cc=containers@lists.linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=htejun@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=lizf@cn.fujitsu.com \
--cc=matthltc@us.ibm.com \
--cc=menage@google.com \
--cc=paul@paulmenage.org \
--cc=rjw@sisk.pl \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.