]> git.baikalelectronics.ru Git - kernel.git/commit
locking/rwsem: Always try to wake waiters in out_nolock path
authorWaiman Long <longman@redhat.com>
Tue, 22 Mar 2022 15:20:59 +0000 (11:20 -0400)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 5 Apr 2022 08:24:35 +0000 (10:24 +0200)
commita3947de45119d06f525325b86f7bd8d658a34244
treef9b36797a5eb085882caa15616daa89a81c09025
parentcde7bde995e3b4a05fd09811e0ca2fa4dca5e322
locking/rwsem: Always try to wake waiters in out_nolock path

For writers, the out_nolock path will always attempt to wake up waiters.
This may not be really necessary if the waiter to be removed is not the
first one.

For readers, no attempt to wake up waiter is being made. However, if
the HANDOFF bit is set and the reader to be removed is the first waiter,
the waiter behind it will inherit the HANDOFF bit and for a write lock
waiter waking it up will allow it to spin on the lock to acquire it
faster. So it can be beneficial to do a wakeup in this case.

Add a new rwsem_del_wake_waiter() helper function to do that consistently
for both reader and writer out_nolock paths.

Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220322152059.2182333-4-longman@redhat.com
kernel/locking/rwsem.c