[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <12503552312863-git-send-email->
Date: Sat, 15 Aug 2009 09:53:49 -0700
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: linux-kernel@...r.kernel.org
Cc: mingo@...e.hu, laijs@...fujitsu.com, dipankar@...ibm.com,
josht@...ux.vnet.ibm.com, akpm@...ux-foundation.org,
mathieu.desnoyers@...ymtl.ca, dvhltc@...ibm.com, niv@...ibm.com,
tglx@...utronix.de, peterz@...radead.org, rostedt@...dmis.org,
hugh.dickins@...cali.co.uk, benh@...nel.crashing.org,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Subject: [PATCH -tip/core/rcu 4/6] Make preemptable RCU scan all CPUs when summing RCU counters.
From: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
This patch eliminates the counter-moving during CPU-offline
notifiers, eliminating potential confusion if counters are
scanned during counter-movement process. This confusion
could result in premature ending of an RCU grace period.
For example, if there are two tasks in RCU read-side critical
sections (so that the sum of the counters is two), and the
counter for the CPU going offline is -2, then moving the
count to another CPU can result in the sum momentarily appearing
to be zero. Since there are no memory barriers in either case,
many more such scenarios are possible.
So just don't move the counts!!!
Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
---
kernel/rcupreempt.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/kernel/rcupreempt.c b/kernel/rcupreempt.c
index 9b87f51..2748b89 100644
--- a/kernel/rcupreempt.c
+++ b/kernel/rcupreempt.c
@@ -849,7 +849,7 @@ rcu_try_flip_waitzero(void)
/* Check to see if the sum of the "last" counters is zero. */
RCU_TRACE_ME(rcupreempt_trace_try_flip_z1);
- for_each_cpu(cpu, to_cpumask(rcu_cpu_online_map))
+ for_each_possible_cpu(cpu)
sum += RCU_DATA_CPU(cpu)->rcu_flipctr[lastidx];
if (sum != 0) {
RCU_TRACE_ME(rcupreempt_trace_try_flip_ze1);
@@ -1067,12 +1067,6 @@ void rcu_offline_cpu(int cpu)
/* seen -after- acknowledgement. */
}
- RCU_DATA_ME()->rcu_flipctr[0] += RCU_DATA_CPU(cpu)->rcu_flipctr[0];
- RCU_DATA_ME()->rcu_flipctr[1] += RCU_DATA_CPU(cpu)->rcu_flipctr[1];
-
- RCU_DATA_CPU(cpu)->rcu_flipctr[0] = 0;
- RCU_DATA_CPU(cpu)->rcu_flipctr[1] = 0;
-
cpumask_clear_cpu(cpu, to_cpumask(rcu_cpu_online_map));
spin_unlock_irqrestore(&rcu_ctrlblk.fliplock, flags);
--
1.5.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists