mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH] rcu: Change use of __this_cpu ops on a bool type
@ 2014-09-19 17:26 Pranith Kumar
  2014-09-19 20:57 ` Josh Triplett
  0 siblings, 1 reply; 3+ messages in thread
From: Pranith Kumar @ 2014-09-19 17:26 UTC (permalink / raw)
  To: Paul E. McKenney, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, open list:READ-COPY UPDATE...

__this_cpu_{read/write}() uses sizeof() to determine the size of the variable.
Using this operation on a bool type causes sparse to complain.

I checked the generated code and there is only a slight difference in
instructions generated.

I am not sure this warning by sparse is really valid, but let us silence it
anyways.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 kernel/rcu/tree.c        | 12 ++++++++----
 kernel/rcu/tree_plugin.h |  6 ++++--
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index bc085e5..85f228a 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -186,21 +186,25 @@ static int rcu_gp_in_progress(struct rcu_state *rsp)
  */
 void rcu_sched_qs(void)
 {
-	if (!__this_cpu_read(rcu_sched_data.passed_quiesce)) {
+	struct rcu_data *rdp = __this_cpu_ptr(&rcu_sched_data);
+
+	if (!rdp->passed_quiesce) {
 		trace_rcu_grace_period(TPS("rcu_sched"),
 				       __this_cpu_read(rcu_sched_data.gpnum),
 				       TPS("cpuqs"));
-		__this_cpu_write(rcu_sched_data.passed_quiesce, 1);
+		rdp->passed_quiesce = true;
 	}
 }
 
 void rcu_bh_qs(void)
 {
-	if (!__this_cpu_read(rcu_bh_data.passed_quiesce)) {
+	struct rcu_data *rdp = __this_cpu_ptr(&rcu_bh_data);
+
+	if (!rdp->passed_quiesce) {
 		trace_rcu_grace_period(TPS("rcu_bh"),
 				       __this_cpu_read(rcu_bh_data.gpnum),
 				       TPS("cpuqs"));
-		__this_cpu_write(rcu_bh_data.passed_quiesce, 1);
+		rdp->passed_quiesce = true;
 	}
 }
 
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 77f9376..98de303 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -143,11 +143,13 @@ EXPORT_SYMBOL_GPL(rcu_batches_completed);
  */
 static void rcu_preempt_qs(void)
 {
-	if (!__this_cpu_read(rcu_preempt_data.passed_quiesce)) {
+	struct rcu_data *rdp = __this_cpu_ptr(&rcu_preempt_data);
+
+	if (!rdp->passed_quiesce) {
 		trace_rcu_grace_period(TPS("rcu_preempt"),
 				       __this_cpu_read(rcu_preempt_data.gpnum),
 				       TPS("cpuqs"));
-		__this_cpu_write(rcu_preempt_data.passed_quiesce, 1);
+		rdp->passed_quiesce = true;
 		barrier(); /* Coordinate with rcu_preempt_check_callbacks(). */
 		current->rcu_read_unlock_special.b.need_qs = false;
 	}
-- 
2.1.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-19 23:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-19 17:26 [RFC PATCH] rcu: Change use of __this_cpu ops on a bool type Pranith Kumar
2014-09-19 20:57 ` Josh Triplett
2014-09-19 23:35   ` Pranith Kumar

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®