From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mathieu.desnoyers@polymtl.ca, mingo@elte.hu,
akpm@linux-foundation.org, hch@infradead.org, mmlnx@us.ibm.com,
dipankar@in.ibm.com, dsmith@redhat.com, rostedt@goodmis.org,
adrian.bunk@movial.fi, a.p.zijlstra@chello.nl, ego@in.ibm.com,
niv@us.ibm.com, dvhltc@us.ibm.com, rusty@au1.ibm.com,
jkenisto@linux.vnet.ibm.com, oleg@tv-sign.ru,
jamesclhuang@yahoo.com
Subject: [PATCH 2/5] Add memory barriers and comments to rcu_check_callbacks()
Date: Mon, 21 Apr 2008 17:46:45 -0700 [thread overview]
Message-ID: <20080422004645.GB3693@linux.vnet.ibm.com> (raw)
In-Reply-To: <20080422004454.GA3517@linux.vnet.ibm.com>
Add comments to the logic that infers quiescent states when interrupting
from either user mode or the idle loop. Also add a memory barrier: it
appears that James Huang was in fact onto something, as the scheduler
is much less synchronization-happy than it once was, so we can no longer
rely on its memory barriers in all cases.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reported-by: James Huang <jamesclhuang@yahoo.com>
---
rcuclassic.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff -urpNa -X dontdiff linux-2.6.25-C1-call_rcu_sched/kernel/rcuclassic.c linux-2.6.25-C2-rcuclassic-fixes/kernel/rcuclassic.c
--- linux-2.6.25-C1-call_rcu_sched/kernel/rcuclassic.c 2008-04-16 19:49:44.000000000 -0700
+++ linux-2.6.25-C2-rcuclassic-fixes/kernel/rcuclassic.c 2008-04-21 10:50:12.000000000 -0700
@@ -502,10 +502,38 @@ void rcu_check_callbacks(int cpu, int us
if (user ||
(idle_cpu(cpu) && !in_softirq() &&
hardirq_count() <= (1 << HARDIRQ_SHIFT))) {
+
+ /*
+ * Get here if this CPU took its interrupt from user
+ * mode or from the idle loop, and if this is not a
+ * nested interrupt. In this case, the CPU is in
+ * a quiescent state, so count it.
+ *
+ * Also do a memory barrier. This is needed to handle
+ * the case where writes from a preempt-disable section
+ * of code get reordered into schedule() by this CPU's
+ * write buffer. The memory barrier makes sure that
+ * the rcu_qsctr_inc() and rcu_bh_qsctr_inc() are see
+ * by other CPUs to happen after any such write.
+ */
+
+ smp_mb(); /* See above block comment. */
rcu_qsctr_inc(cpu);
rcu_bh_qsctr_inc(cpu);
- } else if (!in_softirq())
+
+ } else if (!in_softirq()) {
+
+ /*
+ * Get here if this CPU did not take its interrupt from
+ * softirq, in other words, if it is not interrupting
+ * a rcu_bh read-side critical section. This is an _bh
+ * critical section, so count it. The memory barrier
+ * is needed for the same reason as is the above one.
+ */
+
+ smp_mb(); /* See above block comment. */
rcu_bh_qsctr_inc(cpu);
+ }
raise_rcu_softirq();
}
next prev parent reply other threads:[~2008-04-22 0:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-22 0:44 [PATCH 0/5] call_rcu_sched() series Paul E. McKenney
2008-04-22 0:45 ` Paul E. McKenney
2008-04-22 0:50 ` [PATCH 1/5] Add call_rcu_sched() Paul E. McKenney
2008-05-05 9:14 ` Gautham R Shenoy
2008-05-05 14:43 ` Paul E. McKenney
2008-04-22 0:46 ` Paul E. McKenney [this message]
2008-04-22 0:47 ` [PATCH 3/5] Add rcu_barrier_sched() and rcu_barrier_bh() Paul E. McKenney
2008-05-05 9:22 ` Gautham R Shenoy
2008-05-05 14:47 ` Paul E. McKenney
2008-05-05 17:42 ` Gautham R Shenoy
2008-05-06 5:37 ` Paul E. McKenney
2008-04-22 0:48 ` [PATCH 0/5] call_rcu_sched() series Paul E. McKenney
2008-04-22 0:51 ` Paul E. McKenney
2008-04-22 0:52 ` [PATCH 4/5] Add call_rcu_sched() and friends to rcutorture Paul E. McKenney
2008-04-22 0:49 ` [PATCH 5/5] 1Q08 RCU doc update, add call_rcu_sched() Paul E. McKenney
-- strict thread matches above, loose matches on Subject: below --
2008-04-14 3:58 [PATCH 0/5] call_rcu_sched() series Paul E. McKenney
2008-04-14 4:01 ` [PATCH 2/5] Add memory barriers and comments to rcu_check_callbacks() 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=20080422004645.GB3693@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=adrian.bunk@movial.fi \
--cc=akpm@linux-foundation.org \
--cc=dipankar@in.ibm.com \
--cc=dsmith@redhat.com \
--cc=dvhltc@us.ibm.com \
--cc=ego@in.ibm.com \
--cc=hch@infradead.org \
--cc=jamesclhuang@yahoo.com \
--cc=jkenisto@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mingo@elte.hu \
--cc=mmlnx@us.ibm.com \
--cc=niv@us.ibm.com \
--cc=oleg@tv-sign.ru \
--cc=rostedt@goodmis.org \
--cc=rusty@au1.ibm.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
Powered by JetHome