linux-kernel.vger.kernel.org archive mirror
 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 14:37:06 +0200	[thread overview]
Message-ID: <20110902123706.GB26764@redhat.com> (raw)
In-Reply-To: <201109012108.p81L8X0b029484@imap1.linux-foundation.org>

> 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 12:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201109012108.p81L8X0b029484@imap1.linux-foundation.org>
2011-09-02 12:37 ` Oleg Nesterov [this message]
2011-09-02 14:00   ` + cgroups-more-safe-tasklist-locking-in-cgroup_attach_proc.patch added to -mm tree Oleg Nesterov
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=20110902123706.GB26764@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 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).