Re: [RFC PATCH 0/5] futex: introduce an optimistic spinning futex

From: Thomas Gleixner
Date: Mon Jul 21 2014 - 14:25:23 EST


On Mon, 21 Jul 2014, Andi Kleen wrote:

> Andi Kleen <andi@xxxxxxxxxxxxxx> writes:
>
> > Waiman Long <Waiman.Long@xxxxxx> writes:
> >
> >> This patch series introduces two new futex command codes to support
> >> a new optimistic spinning futex for implementing an exclusive lock
> >> primitive that should perform better than the same primitive using
> >> the wait-wake futex in cases where the lock owner is actively working
> >> instead of waiting for I/O completion.
> >
> > How would you distinguish those two cases automatically?
>
> Also BTW traditionally the spinning was just done in user space.

And traditionally that is based on heuristics, because user space
cannot figure out whether the lock owner is on the CPU or not.

And heuristics suck no matter what.

There have been attempts to expose that information to user space, but
that sucks as well, as it requires updates of that information from
the guts of the scheduler, does not scale at all and what's worse, it
has security implications.

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/