aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/srcu.c
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2012-03-06 04:57:34 -0500
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2012-04-30 13:48:24 -0400
commitdc87917501e324701dbfb249def44054b5220187 (patch)
treee39ebf104875f11b8f6fd56e98366918bacc4dca /kernel/srcu.c
parent966f58c2f6df826f385706673a9bb1edcfd3499a (diff)
rcu: Improve srcu_readers_active_idx()'s cache locality
Expand the calls to srcu_readers_active_idx() from srcu_readers_active() inline. This change improves cache locality by interating over the CPUs once rather than twice. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/srcu.c')
-rw-r--r--kernel/srcu.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/srcu.c b/kernel/srcu.c
index e0139a274856..a43211c92863 100644
--- a/kernel/srcu.c
+++ b/kernel/srcu.c
@@ -193,7 +193,14 @@ static bool srcu_readers_active_idx_check(struct srcu_struct *sp, int idx)
193 */ 193 */
194static int srcu_readers_active(struct srcu_struct *sp) 194static int srcu_readers_active(struct srcu_struct *sp)
195{ 195{
196 return srcu_readers_active_idx(sp, 0) + srcu_readers_active_idx(sp, 1); 196 int cpu;
197 unsigned long sum = 0;
198
199 for_each_possible_cpu(cpu) {
200 sum += ACCESS_ONCE(per_cpu_ptr(sp->per_cpu_ref, cpu)->c[0]);
201 sum += ACCESS_ONCE(per_cpu_ptr(sp->per_cpu_ref, cpu)->c[1]);
202 }
203 return sum;
197} 204}
198 205
199/** 206/**