Re: [PATCH]rcu: avoid unnecessary thread wakeup

From: Shaohua Li
Date: Sun Jun 12 2011 - 20:38:03 EST


On Sat, 2011-06-11 at 00:38 +0800, Paul E. McKenney wrote:
> On Fri, Jun 10, 2011 at 03:50:51PM +0800, Shaohua Li wrote:
> > invoke_rcu_cpu_kthread could be called in the thread itself. In this case,
> > we don't need call wakeup, which is just wasting CPU.
> >
> > Signed-off-by: Shaohua Li <shaohua.li@xxxxxxxxx>
> >
> > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > index 89419ff..f9bd051 100644
> > --- a/kernel/rcutree.c
> > +++ b/kernel/rcutree.c
> > @@ -1475,7 +1475,8 @@ static void invoke_rcu_cpu_kthread(void)
> > local_irq_restore(flags);
> > return;
> > }
> > - wake_up_process(__this_cpu_read(rcu_cpu_kthread_task));
> > + if (current != __this_cpu_read(rcu_cpu_kthread_task))
> > + wake_up_process(__this_cpu_read(rcu_cpu_kthread_task));
> > local_irq_restore(flags);
> > }
>
> Excellent point, thank you!
>
> But how about combining the tests, perhaps something like the
> following?
>
> Unless you have objections or spot problems with it (or it breaks during
> testing), I will queue the patch below with your SOB, since I derived
> it from your patch.
that's better, thanks.

Thanks,
Shaohua

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/