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

From: Nicolas Pitre
Date: Thu Dec 22 2005 - 10:18:45 EST


On Thu, 22 Dec 2005, Andrew Morton wrote:

> I'd prefer to see mutexes compared with semaphores after you've put as much
> work into improving semaphores as you have into developing mutexes.

There is a fundamental difference between semaphores and mutexes. The
semaphore semantics _require_ atomic increments/decrements where mutexes
do not. This makes a huge difference on ARM where 99% of all ARM
processors out there can only perform atomic swaps which is sufficient
for mutexes but insufficient for semaphores. Therefore on ARM
performing an atomic increment/decrement (the semaphore fast
path) requires extra costly locking
and .text space (23 cycles over 8 instructions) while the mutex fast
path is about 2-3 instructions and
needs 7-8 cycles. I bet many other architectures are in the same camp.


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