Re: [PATCH 2/3 v2] futex: avoid double wake up in futex_wake() on -RT
From: Thomas Gleixner
Date: Thu Apr 16 2015 - 05:19:40 EST
On Wed, 15 Apr 2015, Davidlohr Bueso wrote:
> On Sun, 2015-04-12 at 20:02 -0700, Davidlohr Bueso wrote:
> > Doing the wakeups while holding the lock is also a general performance
> > issue for futex_wake. The problem being dealing with spurious wakeups
> > (wacky drivers), which makes no difference wrt nr_wake.
>
> So I did some measurements with the patch below (Cc'ing Arnaldo for
> perf-bench consideration, albeit probably still pretty crude) and by
> doing the lockless wakeups, on avg we reduce contending waking threads
> latency in about 2x for each thread, which indicates that overall
> speedup is based on the number of futex_wake'ers.
>
> I guess now we have the code, the numbers. I go back to auditing drivers
> *sigh*. In any case any important core-code already deals with spurious
> wakeups (the last silly offender being sysv sems), so I'm really not
> _that_ concerned -- in fact, Peter, your patch to trigger them seems to
> not trigger any issues anymore. But perhaps its late and I'm in lala
> land.
OTOH, we have quite some other code in the kernel which can generate
spurious wakeups. Just look at signals.
CPU0 CPU1
T1 random_syscall()
schedule_interruptible()
Send process wide signal, wake T1
because its the first target
T2 do_stuff()
handle_signal()
schedule()
T1 Deal with the spurious wakeup
So any code which does not handle a spurious wakeup is broken
independent of the futex changes. So really nothing to worry about.
Thanks,
tglx
--
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/