From: Pranith Kumar <bobby.prani@gmail.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Josh Triplett <josh@joshtriplett.org>,
Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
linux-kernel@vger.kernel.org (open list:READ-COPY UPDATE...)
Subject: [RFC PATCH] rcu: Change use of __this_cpu ops on a bool type
Date: Fri, 19 Sep 2014 13:26:03 -0400 [thread overview]
Message-ID: <1411147563-9136-1-git-send-email-bobby.prani@gmail.com> (raw)
__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
next reply other threads:[~2014-09-19 17:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-19 17:26 Pranith Kumar [this message]
2014-09-19 20:57 ` Josh Triplett
2014-09-19 23:35 ` Pranith Kumar
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=1411147563-9136-1-git-send-email-bobby.prani@gmail.com \
--to=bobby.prani@gmail.com \
--cc=josh@joshtriplett.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@linux.vnet.ibm.com \
--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®