Skip to content

Commit 5197fcd

Browse files
Yanfei XuPeter Zijlstra
authored andcommitted
locking/rwsem: Fix comments about reader optimistic lock stealing conditions
After the commit 617f3ef ("locking/rwsem: Remove reader optimistic spinning"), reader doesn't support optimistic spinning anymore, there is no need meet the condition which OSQ is empty. BTW, add an unlikely() for the max reader wakeup check in the loop. Signed-off-by: Yanfei Xu <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Waiman Long <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6c2787f commit 5197fcd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

kernel/locking/rwsem.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
*
5757
* A fast path reader optimistic lock stealing is supported when the rwsem
5858
* is previously owned by a writer and the following conditions are met:
59-
* - OSQ is empty
6059
* - rwsem is not currently writer owned
6160
* - the handoff isn't set.
6261
*/
@@ -485,7 +484,7 @@ static void rwsem_mark_wake(struct rw_semaphore *sem,
485484
/*
486485
* Limit # of readers that can be woken up per wakeup call.
487486
*/
488-
if (woken >= MAX_READERS_WAKEUP)
487+
if (unlikely(woken >= MAX_READERS_WAKEUP))
489488
break;
490489
}
491490

0 commit comments

Comments
 (0)