summaryrefslogtreecommitdiff
path: root/kernel/rcupreempt.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2009-08-22 13:56:51 -0700
committerIngo Molnar <mingo@elte.hu>2009-08-23 10:32:39 +0200
commita157229cabd6dd8cfa82525fc9bf730c94cc9ac2 (patch)
tree886013efc2f25dab915640acf46151fac7ae57b4 /kernel/rcupreempt.c
parent22f00b69f6a7e1e18e821979a23e8307c2de9888 (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/rcupreempt.c')
-rw-r--r--kernel/rcupreempt.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/rcupreempt.c b/kernel/rcupreempt.c
index 7d777c9f394c..0053ce56e326 100644
--- a/kernel/rcupreempt.c
+++ b/kernel/rcupreempt.c
@@ -159,6 +159,8 @@ static DEFINE_PER_CPU_SHARED_ALIGNED(struct rcu_dyntick_sched, rcu_dyntick_sched
.dynticks = 1,
};
+static int rcu_pending(int cpu);
+
void rcu_sched_qs(int cpu)
{
struct rcu_dyntick_sched *rdssp = &per_cpu(rcu_dyntick_sched, cpu);
@@ -961,7 +963,10 @@ static void rcu_check_mb(int cpu)
void rcu_check_callbacks(int cpu, int user)
{
unsigned long flags;
- struct rcu_data *rdp = RCU_DATA_CPU(cpu);
+ struct rcu_data *rdp;
+
+ if (!rcu_pending(cpu))
+ return; /* if nothing for RCU to do. */
/*
* If this CPU took its interrupt from user mode or from the
@@ -976,6 +981,7 @@ void rcu_check_callbacks(int cpu, int user)
* CPUs to happen after any such write.
*/
+ rdp = RCU_DATA_CPU(cpu);
if (user ||
(idle_cpu(cpu) && !in_softirq() &&
hardirq_count() <= (1 << HARDIRQ_SHIFT))) {
@@ -1382,7 +1388,7 @@ int rcu_needs_cpu(int cpu)
rdp->waitschedlist != NULL);
}
-int rcu_pending(int cpu)
+static int rcu_pending(int cpu)
{
struct rcu_data *rdp = RCU_DATA_CPU(cpu);