The strange sysv semaphore wakeup scheme has a kind of busy-wait lock
commitc4b6ff6f4f62073be20002a61ad0ad1b7f28edff
authorNick Piggin <npiggin@suse.de>
Tue, 6 Oct 2009 21:46:41 +0000 (6 23:46 +0200)
committerjames toy <toyj@union.edu>
Tue, 6 Oct 2009 21:46:41 +0000 (6 23:46 +0200)
tree8c5ce44d4c820151088a3be60dddbfbde48b3793
parentc30bd4040e61cca70635ce2c80a0c89e8731bd3c
The strange sysv semaphore wakeup scheme has a kind of busy-wait lock
involved, which could deadlock if preemption is enabled during the "lock".

It is an implementation detail (due to a spinlock being held) that this is
actually the case.  However if "spinlocks" are made preemptible, or if the
sem lock is changed to a sleeping lock for example, then the wakeup would
become buggy.  So this might be a bugfix for -rt kernels.

Imagine waker being preempted by wakee and never clearing IN_WAKEUP -- if
wakee has higher RT priority then there is a priority inversion deadlock.
Even if there is not a priority inversion to cause a deadlock, then there
is still time wasted spinning.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Cc: Pierre Peiffer <peifferp@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
ipc/sem.c