[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <163465773536.25758.8800618521559459734.tip-bot2@tip-bot2>
Date: Tue, 19 Oct 2021 15:35:35 -0000
From: "tip-bot2 for Yanfei Xu" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Yanfei Xu <yanfei.xu@...driver.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Waiman Long <longman@...hat.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: locking/core] locking/rwsem: Fix comments about reader
optimistic lock stealing conditions
The following commit has been merged into the locking/core branch of tip:
Commit-ID: 5197fcd09ab6dcc4df79edec7e8e27575276374c
Gitweb: https://git.kernel.org/tip/5197fcd09ab6dcc4df79edec7e8e27575276374c
Author: Yanfei Xu <yanfei.xu@...driver.com>
AuthorDate: Wed, 13 Oct 2021 21:41:54 +08:00
Committer: Peter Zijlstra <peterz@...radead.org>
CommitterDate: Tue, 19 Oct 2021 17:27:06 +02:00
locking/rwsem: Fix comments about reader optimistic lock stealing conditions
After the commit 617f3ef95177 ("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@...driver.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Acked-by: Waiman Long <longman@...hat.com>
Link: https://lore.kernel.org/r/20211013134154.1085649-4-yanfei.xu@windriver.com
---
kernel/locking/rwsem.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
index 884aa08..c51387a 100644
--- a/kernel/locking/rwsem.c
+++ b/kernel/locking/rwsem.c
@@ -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;
}
Powered by blists - more mailing lists