public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH tip/core/urgent] rcu: protect fork-time cgroup access
@ 2010-03-30  9:32 Matt Helsley
  2010-03-30 17:26 ` Paul E. McKenney
  0 siblings, 1 reply; 15+ messages in thread
From: Matt Helsley @ 2010-03-30  9:32 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: Peter Zijlstra, linux-kernel, mingo, laijs, dipankar, akpm,
	mathieu.desnoyers, josh, dvhltc, niv, tglx, rostedt,
	Valdis.Kletnieks, dhowells, eric.dumazet, abogani, menage, lizf,
	containers

> On Mon, Mar 29, 2010 at 11:42:55PM +0200, Peter Zijlstra wrote:
> > On Mon, 2010-03-29 at 14:34 -0700, Paul E. McKenney wrote:
> >
> > > And it appears that my patch is at best insufficient:
> > > http://paste.ubuntu.com/406189/
> > >
> > > Left to myself, I would wrap copy_process() with rcu_read_lock(),
> > > but I would rather hear your thoughts before doing too much more
> > > semi-random hacking.  ;-)
> >
> > Well, I don't think you can get away with that, copy_process() wants to
> > sleep on quite a few places ;-) Also, locks should be taken at the
> > smallest possible scope, unless we want to go back to BKL style
> > locking :-)
> 
> No argument here!  ;-)
> 
> > As to that freezer splat, you'd have to chase down the cgroup folks, I'm
> > fully ignorant on that.
> 
> K, adding them to CC.  The two splats are:
> 
>        http://pastebin.ubuntu.com/406131/
>         http://paste.ubuntu.com/406189/

Please feel free to Cc me on cgroup freezer stuff.

There's a comment in the code explaining why it's not used in freezer_fork():

       /*
        * No lock is needed, since the task isn't on tasklist yet,
        * so it can't be moved to another cgroup, which means the
        * freezer won't be removed and will be valid during this
        * function call.
        */
	freezer = task_freezer(task);

Cheers,
	-Matt Helsley

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [PATCH tip/core/urgent] rcu: protect fork-time cgroup access
@ 2010-03-29 21:15 Paul E. McKenney
  2010-03-29 21:19 ` Peter Zijlstra
  2010-03-29 22:43 ` Paul Menage
  0 siblings, 2 replies; 15+ messages in thread
From: Paul E. McKenney @ 2010-03-29 21:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, abogani

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();
 
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
 	if (likely(sched_info_on()))

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-03-30 18:57 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-30  9:32 [PATCH tip/core/urgent] rcu: protect fork-time cgroup access Matt Helsley
2010-03-30 17:26 ` Paul E. McKenney
  -- strict thread matches above, loose matches on Subject: below --
2010-03-29 21:15 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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox