From: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
To: dave@stgolabs.net, paulmck@kernel.org, josh@joshtriplett.org,
frederic@kernel.org, neeraj.upadhyay@kernel.org,
rostedt@goodmis.org
Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org,
Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Subject: [PATCH v2] rcu/segcblist: Use WRITE_ONCE() for rclp->len decrement
Date: Thu, 11 Sep 2025 21:56:41 +0530 [thread overview]
Message-ID: <20250911162641.796716-1-kaushlendra.kumar@intel.com> (raw)
Use WRITE_ONCE() for rclp->len decrement in rcu_cblist_dequeue() to
maintain consistency with rcu_cblist_enqueue(), which already uses
WRITE_ONCE() for rclp->len increment. It maintains consistent access
patterns to the rclp->len field across both enqueue and dequeue operations.
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
Changes in v2:
- Revised justification to focus on code consistency rather than
concurrent access claims.
- Revised commit message to use imperative mood throughout per kernel
documentation guidelines (suggested by Markus Elfring).
kernel/rcu/rcu_segcblist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/rcu_segcblist.c b/kernel/rcu/rcu_segcblist.c
index 1693ea22ef1b..e10b36e9de54 100644
--- a/kernel/rcu/rcu_segcblist.c
+++ b/kernel/rcu/rcu_segcblist.c
@@ -71,7 +71,7 @@ struct rcu_head *rcu_cblist_dequeue(struct rcu_cblist *rclp)
rhp = rclp->head;
if (!rhp)
return NULL;
- rclp->len--;
+ WRITE_ONCE(rclp->len, rclp->len - 1);
rclp->head = rhp->next;
if (!rclp->head)
rclp->tail = &rclp->head;
--
2.34.1
next reply other threads:[~2025-09-11 16:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-11 16:26 Kaushlendra Kumar [this message]
2025-09-11 18:18 ` Davidlohr Bueso
2025-09-11 19:41 ` Paul E. McKenney
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=20250911162641.796716-1-kaushlendra.kumar@intel.com \
--to=kaushlendra.kumar@intel.com \
--cc=dave@stgolabs.net \
--cc=frederic@kernel.org \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
/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
all inboxes | Powered by JetHome®