diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2009-08-22 16:56:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-23 04:32:39 -0400 |
commit | a157229cabd6dd8cfa82525fc9bf730c94cc9ac2 (patch) | |
tree | 886013efc2f25dab915640acf46151fac7ae57b4 /kernel/rcutree.c | |
parent | 22f00b69f6a7e1e18e821979a23e8307c2de9888 (diff) |
rcu: Simplify rcu_pending()/rcu_check_callbacks() API
All calls from outside RCU are of the form:
if (rcu_pending(cpu))
rcu_check_callbacks(cpu, user);
This is silly, instead we put a call to rcu_pending() in
rcu_check_callbacks(), and then make the outside calls be to
rcu_check_callbacks(). This cuts down on the code a bit and
also gives the compiler a better chance of optimizing.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: akpm@linux-foundation.org
Cc: mathieu.desnoyers@polymtl.ca
Cc: josht@linux.vnet.ibm.com
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
LKML-Reference: <125097461311-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r-- | kernel/rcutree.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 7c515082ae84..4ce3adcfa94d 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -111,6 +111,7 @@ static int qhimark = 10000; /* If this many pending, ignore blimit. */ | |||
111 | static int qlowmark = 100; /* Once only this many pending, use blimit. */ | 111 | static int qlowmark = 100; /* Once only this many pending, use blimit. */ |
112 | 112 | ||
113 | static void force_quiescent_state(struct rcu_state *rsp, int relaxed); | 113 | static void force_quiescent_state(struct rcu_state *rsp, int relaxed); |
114 | static int rcu_pending(int cpu); | ||
114 | 115 | ||
115 | /* | 116 | /* |
116 | * Return the number of RCU-sched batches processed thus far for debug & stats. | 117 | * Return the number of RCU-sched batches processed thus far for debug & stats. |
@@ -974,6 +975,8 @@ static void rcu_do_batch(struct rcu_data *rdp) | |||
974 | */ | 975 | */ |
975 | void rcu_check_callbacks(int cpu, int user) | 976 | void rcu_check_callbacks(int cpu, int user) |
976 | { | 977 | { |
978 | if (!rcu_pending(cpu)) | ||
979 | return; /* if nothing for RCU to do. */ | ||
977 | if (user || | 980 | if (user || |
978 | (idle_cpu(cpu) && rcu_scheduler_active && | 981 | (idle_cpu(cpu) && rcu_scheduler_active && |
979 | !in_softirq() && hardirq_count() <= (1 << HARDIRQ_SHIFT))) { | 982 | !in_softirq() && hardirq_count() <= (1 << HARDIRQ_SHIFT))) { |
@@ -1329,7 +1332,7 @@ static int __rcu_pending(struct rcu_state *rsp, struct rcu_data *rdp) | |||
1329 | * by the current CPU, returning 1 if so. This function is part of the | 1332 | * by the current CPU, returning 1 if so. This function is part of the |
1330 | * RCU implementation; it is -not- an exported member of the RCU API. | 1333 | * RCU implementation; it is -not- an exported member of the RCU API. |
1331 | */ | 1334 | */ |
1332 | int rcu_pending(int cpu) | 1335 | static int rcu_pending(int cpu) |
1333 | { | 1336 | { |
1334 | return __rcu_pending(&rcu_sched_state, &per_cpu(rcu_sched_data, cpu)) || | 1337 | return __rcu_pending(&rcu_sched_state, &per_cpu(rcu_sched_data, cpu)) || |
1335 | __rcu_pending(&rcu_bh_state, &per_cpu(rcu_bh_data, cpu)); | 1338 | __rcu_pending(&rcu_bh_state, &per_cpu(rcu_bh_data, cpu)); |