* [PATCH 11/24] jrcu: use xchg to toggle rcu_which
@ 2011-03-24 17:48 Joe Korty
0 siblings, 0 replies; only message in thread
From: Joe Korty @ 2011-03-24 17:48 UTC (permalink / raw)
To: paulmck
Cc: fweisbec, peterz, laijs, mathieu.desnoyers, dhowells, loic.minier,
dhaval.giani, tglx, josh, houston.jim, andi, linux-kernel
Use xchg rather than wmb()s to change the value
of rcu_which.
This may be better than wmb()s as xchg will not
let the insn counter advance past the xchg until
the exchanged result is visible to other cpus.
Signed-off-by: Joe Korty <joe.korty@ccur.com>
Index: b/kernel/jrcu.c
===================================================================
--- a/kernel/jrcu.c
+++ b/kernel/jrcu.c
@@ -371,14 +371,16 @@ static void __rcu_delimit_batches(struct
else
rd->wait = 0;
}
+ smp_wmb(); /* just paranoia, the below xchg should do this on all archs */
/*
- * Swap current and previous lists. The other cpus must not see this
- * out-of-order w.r.t. the above emptying of each cpu's previous list,
- * hence the smp_wmb.
+ * Swap current and previous lists. The other cpus must not
+ * see this out-of-order w.r.t. the above emptying of each cpu's
+ * previous list. The xchg accomplishes that and, as a side (but
+ * seemingly unneeded) bonus, keeps this cpu from advancing its insn
+ * counter until the results of that xchg are visible on other cpus.
*/
- smp_wmb();
- rcu_which = prev;
+ xchg(&rcu_which, prev); /* only place where rcu_which is written to */
rcu_stats.nbatches++;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-03-24 17:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-24 17:48 [PATCH 11/24] jrcu: use xchg to toggle rcu_which Joe Korty
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox