Skip to content

Commit

Permalink
locking/rwsem: Fix comments about reader optimistic lock stealing con…
Browse files Browse the repository at this point in the history
…ditions

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 <yanfei.xu@windriver.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Waiman Long <longman@redhat.com>
Link: https://lore.kernel.org/r/20211013134154.1085649-4-yanfei.xu@windriver.com
  • Loading branch information
Yanfei Xu authored and Peter Zijlstra committed Oct 19, 2021
1 parent 6c2787f commit 5197fcd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions kernel/locking/rwsem.c
Original file line number Diff line number Diff line change
@@ -56,7 +56,6 @@
*
* A fast path reader optimistic lock stealing is supported when the rwsem
* is previously owned by a writer and the following conditions are met:
* - OSQ is empty
* - rwsem is not currently writer owned
* - the handoff isn't set.
*/
@@ -485,7 +484,7 @@ static void rwsem_mark_wake(struct rw_semaphore *sem,
/*
* Limit # of readers that can be woken up per wakeup call.
*/
if (woken >= MAX_READERS_WAKEUP)
if (unlikely(woken >= MAX_READERS_WAKEUP))
break;
}

0 comments on commit 5197fcd

Please sign in to comment.