All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, bblum@andrew.cmu.edu,
	fweisbec@gmail.com, neilb@suse.de, paul@paulmenage.org,
	paulmck@linux.vnet.ibm.com
Subject: Re: + cgroups-more-safe-tasklist-locking-in-cgroup_attach_proc.patch added to -mm tree
Date: Fri, 2 Sep 2011 16:00:15 +0200	[thread overview]
Message-ID: <20110902140015.GA31530@redhat.com> (raw)
In-Reply-To: <20110902123706.GB26764@redhat.com>

Forgot to mention, sorry...

That said, I believe the patch is correct and should fix the problem.

On 09/02, Oleg Nesterov wrote:
>
> > From: Ben Blum <bblum@andrew.cmu.edu>
> >
> > Fix unstable tasklist locking in cgroup_attach_proc.
> >
> > According to this thread - https://lkml.org/lkml/2011/7/27/243 - RCU is
> > not sufficient to guarantee the tasklist is stable w.r.t.  de_thread and
> > exit.  Taking tasklist_lock for reading, instead of rcu_read_lock, ensures
> > proper exclusion.
>
> I still think we should avoid the global lock.
>
> In any case, with tasklist or siglock,
>
> > -	rcu_read_lock();
> > +	read_lock(&tasklist_lock);
> >  	if (!thread_group_leader(leader)) {
> >  		/*
> >  		 * a race with de_thread from another thread's exec() may strip
> > @@ -2036,7 +2036,7 @@ int cgroup_attach_proc(struct cgroup *cg
> >  		 * throw this task away and try again (from cgroup_procs_write);
> >  		 * this is "double-double-toil-and-trouble-check locking".
> >  		 */
> > -		rcu_read_unlock();
> > +		read_unlock(&tasklist_lock);
> >  		retval = -EAGAIN;
>
> this check+comment becomes completely pointless and imho very confusing.
>
> Oleg.


  reply	other threads:[~2011-09-02 14:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01 21:08 + cgroups-more-safe-tasklist-locking-in-cgroup_attach_proc.patch added to -mm tree akpm
2011-09-02 12:37 ` Oleg Nesterov
2011-09-02 14:00   ` Oleg Nesterov [this message]
2011-09-02 14:15     ` Ben Blum
2011-09-02 15:55       ` Oleg Nesterov
2011-09-07 23:59         ` Ben Blum
2011-09-08 17:35           ` Oleg Nesterov
2011-09-08 18:58             ` Ben Blum
2011-09-08 21:31               ` Oleg Nesterov
2011-09-09  2:11                 ` Ben Blum
2011-09-09 16:41                   ` Oleg Nesterov

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=20110902140015.GA31530@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bblum@andrew.cmu.edu \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=paul@paulmenage.org \
    --cc=paulmck@linux.vnet.ibm.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 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.