linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for Yanfei Xu" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Yanfei Xu <yanfei.xu@windriver.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Waiman Long <longman@redhat.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: locking/core] locking/rwsem: Fix comments about reader optimistic lock stealing conditions
Date: Tue, 19 Oct 2021 15:35:35 -0000	[thread overview]
Message-ID: <163465773536.25758.8800618521559459734.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20211013134154.1085649-4-yanfei.xu@windriver.com>

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@windriver.com>
AuthorDate:    Wed, 13 Oct 2021 21:41:54 +08:00
Committer:     Peter Zijlstra <peterz@infradead.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@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
---
 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;
 	}
 

  reply	other threads:[~2021-10-19 15:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 13:41 [PATCH V2 0/3] misc patches for mutex and rwsem Yanfei Xu
2021-10-13 13:41 ` [PATCH V2 1/3] locking: remove rcu_read_lock/unlock as we already disabled preemption Yanfei Xu
2021-10-19 15:35   ` [tip: locking/core] locking: Remove rcu_read_{,un}lock() for preempt_{dis,en}able() tip-bot2 for Yanfei Xu
2021-10-13 13:41 ` [PATCH v2 2/3] locking/rwsem: disable preemption for spinning region Yanfei Xu
2021-10-15 10:13   ` Peter Zijlstra
2021-10-15 10:20     ` Peter Zijlstra
2021-10-15 12:33       ` Xu, Yanfei
2021-10-19 15:35   ` [tip: locking/core] locking/rwsem: Disable " tip-bot2 for Yanfei Xu
2021-10-13 13:41 ` [PATCH V2 3/3] locking/rwsem: fix comments about reader optimistic lock stealing conditions Yanfei Xu
2021-10-19 15:35   ` tip-bot2 for Yanfei Xu [this message]
2021-10-13 21:08 ` [PATCH V2 0/3] misc patches for mutex and rwsem Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=163465773536.25758.8800618521559459734.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    --cc=yanfei.xu@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).