All of lore.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
       [not found] ` <20100330093204.GP3345-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
  0 siblings, 2 replies; 17+ 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] 17+ messages in thread
* Re: [PATCH tip/core/urgent] rcu: protect fork-time cgroup access
@ 2010-03-30  9:32 Matt Helsley
  0 siblings, 0 replies; 17+ messages in thread
From: Matt Helsley @ 2010-03-30  9:32 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: menage-hpIqsD4AKlfQT0dZR+AlfA, dvhltc-r/Jw6+rmf7HQT0dZR+AlfA,
	mathieu.desnoyers-scC8bbJcJLCw5LPnMra/2Q,
	eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	rostedt-nx8X9YLhiw1AfugRpC6u6w, josh-iaAMLnmF4UmaiuxdJuQwMA,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA, niv-r/Jw6+rmf7HQT0dZR+AlfA,
	tglx-hfZtesqFncYOwBW4kG4KsQ, dipankar-xthvdsQ13ZrQT0dZR+AlfA,
	Valdis.Kletnieks-PjAqaU27lzQ, mingo-X9Un+BFzKDI,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	abogani-c2gU+FDvWfqonA0d6jMUrA

> 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] 17+ 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; 17+ 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] 17+ messages in thread

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

Thread overview: 17+ 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
     [not found] ` <20100330093204.GP3345-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-03-30 17:26   ` Paul E. McKenney
  -- strict thread matches above, loose matches on Subject: below --
2010-03-30  9:32 Matt Helsley
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 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.