Re: [patch 0/9] mutex subsystem, -V4

From: Linus Torvalds
Date: Thu Dec 22 2005 - 12:40:37 EST




On Thu, 22 Dec 2005, Thomas Gleixner wrote:
>
> Semaphores need a counter, mutexes only a binary representation of the
> locked/unlocked state

Actually, that's not true.

A _spinlock_ only needs a binary representation of the locked/unlocked
state.

A mutex needs a _ternary_ representation. It needs an additional
"contention" state to tell the wakeup that extra action is needed.

If you don't handle contention (and do extra action all the time), you're
screwed from a performance standpoint.

Linus
-
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/