From: "Paul E. McKenney" <paulmck@kernel.org>
To: frederic@kernel.org, rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
rostedt@goodmis.org, "Paul E. McKenney" <paulmck@kernel.org>
Subject: [PATCH rcu 7/7] rcu-tasks: Remove open-coded one-byte cmpxchg() emulation
Date: Wed, 9 Oct 2024 11:00:45 -0700 [thread overview]
Message-ID: <20241009180045.777721-7-paulmck@kernel.org> (raw)
In-Reply-To: <2dc6de07-374d-44da-82e9-fa9d9c516b46@paulmck-laptop>
This commit removes the open-coded one-byte cmpxchg() emulation from
rcu_trc_cmpxchg_need_qs(), replacing it with just cmpxchg() given the
latter's new-found ability to handle single-byte arguments across all
architectures.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/tasks.h | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index dd9730fd44fbe..c789d994e7ebc 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -1541,22 +1541,7 @@ static void rcu_st_need_qs(struct task_struct *t, u8 v)
*/
u8 rcu_trc_cmpxchg_need_qs(struct task_struct *t, u8 old, u8 new)
{
- union rcu_special ret;
- union rcu_special trs_old = READ_ONCE(t->trc_reader_special);
- union rcu_special trs_new = trs_old;
-
- if (trs_old.b.need_qs != old)
- return trs_old.b.need_qs;
- trs_new.b.need_qs = new;
-
- // Although cmpxchg() appears to KCSAN to update all four bytes,
- // only the .b.need_qs byte actually changes.
- instrument_atomic_read_write(&t->trc_reader_special.b.need_qs,
- sizeof(t->trc_reader_special.b.need_qs));
- // Avoid false-positive KCSAN failures.
- ret.s = data_race(cmpxchg(&t->trc_reader_special.s, trs_old.s, trs_new.s));
-
- return ret.b.need_qs;
+ return cmpxchg(&t->trc_reader_special.b.need_qs, old, new);
}
EXPORT_SYMBOL_GPL(rcu_trc_cmpxchg_need_qs);
--
2.40.1
prev parent reply other threads:[~2024-10-09 18:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 18:00 [PATCH rcu 0/7] Miscellaneous changes for v6.13 Paul E. McKenney
2024-10-09 18:00 ` [PATCH rcu 1/7] rcu: Add rcuog kthreads to RCU_NOCB_CPU help text Paul E. McKenney
2024-10-09 18:00 ` [PATCH rcu 2/7] doc: Add rcuog kthreads to kernel-per-CPU-kthreads.rst Paul E. McKenney
2024-10-09 18:00 ` [PATCH rcu 3/7] rcu: Allow short-circuiting of synchronize_rcu_tasks_rude() Paul E. McKenney
2024-10-09 18:00 ` [PATCH rcu 4/7] rcu: Permit start_poll_synchronize_rcu*() with interrupts disabled Paul E. McKenney
2024-10-09 18:00 ` [PATCH rcu 5/7] rcutorture: Test start-poll primitives " Paul E. McKenney
2024-10-09 18:00 ` [PATCH rcu 6/7] doc: Remove kernel-parameters.txt entry for rcutorture.read_exit Paul E. McKenney
2024-10-09 18:00 ` Paul E. McKenney [this message]
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=20241009180045.777721-7-paulmck@kernel.org \
--to=paulmck@kernel.org \
--cc=frederic@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.