Re: [PATCH 11/16] rcu: Check for spurious wakeup using return value

Paul E. McKenney
2014-07-24T20:28:00Z

On Thu, Jul 24, 2014 at 03:59:33PM -0400, Pranith Kumar wrote:
> Adding peterz to CC as git blames him for wait_event code. :)
>
> (original LKML link: https://lkml.org/lkml/2014/7/23/45)
>
> On Thu, Jul 24, 2014 at 2:12 PM, Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:

[ . . . ]

> >> If we care about what wait_event_interruptible() returns, we can go
> >> back and wait for an actual wakeup much earlier without the additional
> >> overhead of calling rcu_gp_init().
> >
> > The key phrase here is "If we care". Should we care? If so, why?
> >
> > I suggest running some random benchmark and counting how many times
> > rcu_gp_init() is called and how many times rcu_gp_init() returns
> > because ->gp_flags is not set. If rcu_gp_init() returns because
> > ->gp_flags is not set a significant fraction of the time, then this
> > -might- be worth worrying about. (Extra credit: Under what conditions
>
> In the grand scheme of things, I agree that minor optimizations may not seem
> to be worth much. But when the optimizationss are straight forward and
> are _actually_ improving things, even by a small margin, I think they are
> worth considering.
>
> Think of the billions of cycles we will save ;-)

If there are significant savings. You have yet to demonstrate this.
In fact, you have yet to demonstrate that your change doesn't make
things worse.

Thanx, Paul

> > -might- be worth worrying about. (Extra credit: Under what conditions
> > would it be worth worrying about, and how would you go about checking
> > to see whether those conditions hold?)
> >
>
>
> --
> Pranith
>