]> git.baikalelectronics.ru Git - kernel.git/commit
locking/mutex: clear MUTEX_FLAGS if wait_list is empty due to signal
authorZqiang <qiang.zhang@windriver.com>
Mon, 17 May 2021 03:40:05 +0000 (11:40 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 18 May 2021 10:53:51 +0000 (12:53 +0200)
commitf4051a3860f7b40c9e65d393162658f1d9f28b15
tree58eb2fd9fc9f8f9bb56034835688d189403a028c
parent7cc4d4e6c3b8a71009c4ca34f617a2d654b9ce2b
locking/mutex: clear MUTEX_FLAGS if wait_list is empty due to signal

When a interruptible mutex locker is interrupted by a signal
without acquiring this lock and removed from the wait queue.
if the mutex isn't contended enough to have a waiter
put into the wait queue again, the setting of the WAITER
bit will force mutex locker to go into the slowpath to
acquire the lock every time, so if the wait queue is empty,
the WAITER bit need to be clear.

Fixes: 4f564575757a ("mutex: Add support for wound/wait style locks")
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Zqiang <qiang.zhang@windriver.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210517034005.30828-1-qiang.zhang@windriver.com
kernel/locking/mutex-debug.c
kernel/locking/mutex-debug.h
kernel/locking/mutex.c
kernel/locking/mutex.h