From: "Paul E. McKenney" <paulmck@kernel.org>
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
rostedt@goodmis.org, "Uladzislau Rezki (Sony)" <urezki@gmail.com>,
"Paul E . McKenney" <paulmck@kernel.org>
Subject: [PATCH rcu 6/8] rcu/kvfree: Use READ_ONCE() when access to krcp->head
Date: Wed, 4 Jan 2023 16:24:46 -0800 [thread overview]
Message-ID: <20230105002448.1768892-6-paulmck@kernel.org> (raw)
In-Reply-To: <20230105002441.GA1768817@paulmck-ThinkPad-P17-Gen-1>
From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
The need_offload_krc() function is now lock-free, which gives the
compiler freedom to load old values from plain C-language loads from
the kfree_rcu_cpu struture's ->head pointer. This commit therefore
applied READ_ONCE() to these loads.
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/tree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 735312f78e980..02551e0e11328 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3165,7 +3165,7 @@ need_offload_krc(struct kfree_rcu_cpu *krcp)
if (!list_empty(&krcp->bulk_head[i]))
return true;
- return !!krcp->head;
+ return !!READ_ONCE(krcp->head);
}
static void
@@ -3206,7 +3206,7 @@ static void kfree_rcu_monitor(struct work_struct *work)
// in that case the monitor work is rearmed.
if ((!list_empty(&krcp->bulk_head[0]) && list_empty(&krwp->bulk_head_free[0])) ||
(!list_empty(&krcp->bulk_head[1]) && list_empty(&krwp->bulk_head_free[1])) ||
- (krcp->head && !krwp->head_free)) {
+ (READ_ONCE(krcp->head) && !krwp->head_free)) {
// Channel 1 corresponds to the SLAB-pointer bulk path.
// Channel 2 corresponds to vmalloc-pointer bulk path.
--
2.31.1.189.g2e36527f23
next prev parent reply other threads:[~2023-01-05 0:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 0:24 [PATCH rcu 0/8] kvfree_rcu updates for v6.3 Paul E. McKenney
2023-01-05 0:24 ` [PATCH rcu 1/8] rcu: Refactor kvfree_call_rcu() and high-level helpers Paul E. McKenney
2023-01-05 0:24 ` [PATCH rcu 2/8] rcu/kvfree: Switch to a generic linked list API Paul E. McKenney
2023-01-05 0:24 ` [PATCH rcu 3/8] rcu/kvfree: Move bulk/list reclaim to separate functions Paul E. McKenney
2023-01-05 0:24 ` [PATCH rcu 4/8] rcu/kvfree: Move need_offload_krc() out of krcp->lock Paul E. McKenney
2023-01-05 0:24 ` [PATCH rcu 5/8] rcu/kvfree: Use a polled API to speedup a reclaim process Paul E. McKenney
2023-01-05 0:24 ` Paul E. McKenney [this message]
2023-01-05 0:24 ` [PATCH rcu 7/8] rcu/kvfree: Carefully reset number of objects in krcp Paul E. McKenney
2023-01-05 0:24 ` [PATCH rcu 8/8] rcu/kvfree: Split ready for reclaim objects from a batch Paul E. McKenney
2023-02-03 1:43 ` [PATCH rcu 9/8] Add kvfree_rcu_mightsleep() and kfree_rcu_mightsleep() 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=20230105002448.1768892-6-paulmck@kernel.org \
--to=paulmck@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=urezki@gmail.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