A workaround for an unmatched locker-unlocker mutex problem.

If sleepers on a mutex were more than one, only one of them was woken up. This
caused the other ones to sleep forever. Now, there is not any facility to check
if there are still sleepers on the kernel space when a thread is about to unlock
a mutex. To workaround this problem, we started waking up all the threads
instead of one. This brings another problem called thundering herd but also
provides random fairness which gives more oppurtunity to a higher priority
thread to get the lock.
This commit is contained in:
Bora Sahin
2009-11-16 19:06:45 +02:00
parent 58959d5fb0
commit 7fb923cd35

View File

@@ -210,7 +210,7 @@ int mutex_control_unlock(struct mutex_queue_head *mqhead,
* now wake all of them up in FIFO order.
* FIXME: Make sure this is FIFO order. It doesn't seem so.
*/
wake_up(&mutex_queue->wqh_contenders, WAKEUP_ASYNC);
wake_up_all(&mutex_queue->wqh_contenders, WAKEUP_ASYNC);
/* Since noone is left, delete the mutex queue */
mutex_control_remove(mqhead, mutex_queue);