All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Menage <menage@google.com>,
	linux-kernel@vger.kernel.org, mingo@elte.hu,
	laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca,
	josh@joshtriplett.org, dvhltc@us.ibm.com, niv@us.ibm.com,
	tglx@linutronix.de, rostedt@goodmis.org, Valdis.Kletnieks@vt.edu,
	dhowells@redhat.com, eric.dumazet@gmail.com, abogani@texware.it
Subject: Re: [PATCH tip/core/urgent] rcu: protect fork-time cgroup access
Date: Tue, 30 Mar 2010 10:28:08 -0700	[thread overview]
Message-ID: <20100330172808.GK2513@linux.vnet.ibm.com> (raw)
In-Reply-To: <1269939034.5109.511.camel@twins>

On Tue, Mar 30, 2010 at 10:50:34AM +0200, Peter Zijlstra wrote:
> On Mon, 2010-03-29 at 15:43 -0700, Paul Menage wrote:
> > On Mon, Mar 29, 2010 at 2:15 PM, Paul E. McKenney
> > <paulmck@linux.vnet.ibm.com> wrote:
> > > Add an rcu_read_lock() / rcu_read_unlock() pair to protect a fork-time
> > > cgroup access.  This seems likely to be a false positive.
> > >
> > > Located by: Alessio Igor Bogani <abogani@texware.it>
> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > ---
> > >
> > >  sched.c |    2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/kernel/sched.c b/kernel/sched.c
> > > index 9ab3cd7..d4bb5e0 100644
> > > --- a/kernel/sched.c
> > > +++ b/kernel/sched.c
> > > @@ -2621,7 +2621,9 @@ void sched_fork(struct task_struct *p, int clone_flags)
> > >        if (p->sched_class->task_fork)
> > >                p->sched_class->task_fork(p);
> > >
> > > +       rcu_read_lock();
> > >        set_task_cpu(p, cpu);
> > > +       rcu_read_unlock();
> > 
> > I think you're right that this is a false positive - it would only be
> > a problem if it were possible for the task to be moved to a different
> > cgroup, and I think that shouldn't be the case at this point in the
> > fork path since the new process isn't visible on the tasklist yet,
> > right?
> 
> Well the thing is, this fork time invocation of
> set_task_cpu()->set_task_rq() is in no way special, there's multiple
> places like that.

Certainly the lack of clarity about why this access is safe indicates
that recording some of the locking design in rcu_dereferenceI() would
be quite helpful.  ;-)

							Thanx, Paul

  reply	other threads:[~2010-03-30 17:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-29 21:15 [PATCH tip/core/urgent] rcu: protect fork-time cgroup access Paul E. McKenney
2010-03-29 21:19 ` Peter Zijlstra
2010-03-29 21:26   ` Peter Zijlstra
2010-03-29 22:24     ` Paul E. McKenney
2010-03-29 21:29   ` Paul E. McKenney
2010-03-29 21:34     ` Paul E. McKenney
2010-03-29 21:42       ` Peter Zijlstra
2010-03-29 21:51         ` Paul E. McKenney
2010-03-29 22:43 ` Paul Menage
2010-03-29 23:05   ` Paul E. McKenney
2010-03-30 18:57     ` Paul Menage
2010-03-30  8:50   ` Peter Zijlstra
2010-03-30 17:28     ` Paul E. McKenney [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-03-30  9:32 Matt Helsley
     [not found] ` <20100330093204.GP3345-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-03-30 17:26   ` Paul E. McKenney
2010-03-30 17:26 ` Paul E. McKenney
2010-03-30  9:32 Matt Helsley

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=20100330172808.GK2513@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=abogani@texware.it \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=dvhltc@us.ibm.com \
    --cc=eric.dumazet@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=menage@google.com \
    --cc=mingo@elte.hu \
    --cc=niv@us.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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.