I couldn't think of a lightweight way to determine when the owner has
been scheduled out in userspace. Kernel assistance is required. You
could do this on the schedule() side of things, but I figured I'd get
some strong pushback if I tried to add a hook into descheduling that
flipped a bit in the futex value stating the owner was about to
deschedule(). Still, that might be something to explore.
Sorry, I meant to include that. I tested on an 8 CPU (no hardware
threads) 2.6 GHz Opteron 2218 (2 QuadCore CPUs) system.
> At 10%
Perhaps some instrumentation is in order, it seems to get invoked enough
to achieve some 20% increase in lock/unlock iterations. Perhaps another
metric would be of more value - such as average wait time?
Perhaps something NR_CPUS threads would be of more interest? At 10%
that's about .8 and at 25% the 2 of your upper limit. I could add a few
more duty-cycle points and make 25% the max. I'll kick that off and post
the results... probably tomorrow, 10M iterations takes a while, but
makes the results relatively stable.
The wakeup code selects the highest priority task in fifo order to
wake-up - however, under contention it is most likely going to go back
to sleep as another waiter will steal the lock out from under it. This
locking strategy is unashamedly about as "unfair" as it gets.
--
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team
--