rcu: No interrupt disabling for rcu_prepare_for_idle()

The rcu_prepare_for_idle() function is always called with interrupts
disabled, so there is no reason to disable interrupts again within
rcu_prepare_for_idle().  Therefore, this commit removes all of the
interrupt disabling, also removing a latent disabling-unbalance bug.

Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
This commit is contained in:
Paul E. McKenney 2012-01-23 17:23:35 -08:00 committed by Paul E. McKenney
parent 3d3b7db0a2
commit c0cfbbb0d4

View file

@ -2096,10 +2096,6 @@ static void rcu_cleanup_after_idle(int cpu)
*/ */
static void rcu_prepare_for_idle(int cpu) static void rcu_prepare_for_idle(int cpu)
{ {
unsigned long flags;
local_irq_save(flags);
/* /*
* If there are no callbacks on this CPU, enter dyntick-idle mode. * If there are no callbacks on this CPU, enter dyntick-idle mode.
* Also reset state to avoid prejudicing later attempts. * Also reset state to avoid prejudicing later attempts.
@ -2107,7 +2103,6 @@ static void rcu_prepare_for_idle(int cpu)
if (!rcu_cpu_has_callbacks(cpu)) { if (!rcu_cpu_has_callbacks(cpu)) {
per_cpu(rcu_dyntick_holdoff, cpu) = jiffies - 1; per_cpu(rcu_dyntick_holdoff, cpu) = jiffies - 1;
per_cpu(rcu_dyntick_drain, cpu) = 0; per_cpu(rcu_dyntick_drain, cpu) = 0;
local_irq_restore(flags);
trace_rcu_prep_idle("No callbacks"); trace_rcu_prep_idle("No callbacks");
return; return;
} }
@ -2117,7 +2112,6 @@ static void rcu_prepare_for_idle(int cpu)
* refrained from disabling the scheduling-clock tick. * refrained from disabling the scheduling-clock tick.
*/ */
if (per_cpu(rcu_dyntick_holdoff, cpu) == jiffies) { if (per_cpu(rcu_dyntick_holdoff, cpu) == jiffies) {
local_irq_restore(flags);
trace_rcu_prep_idle("In holdoff"); trace_rcu_prep_idle("In holdoff");
return; return;
} }
@ -2142,7 +2136,6 @@ static void rcu_prepare_for_idle(int cpu)
} else if (--per_cpu(rcu_dyntick_drain, cpu) <= 0) { } else if (--per_cpu(rcu_dyntick_drain, cpu) <= 0) {
/* We have hit the limit, so time to give up. */ /* We have hit the limit, so time to give up. */
per_cpu(rcu_dyntick_holdoff, cpu) = jiffies; per_cpu(rcu_dyntick_holdoff, cpu) = jiffies;
local_irq_restore(flags);
trace_rcu_prep_idle("Begin holdoff"); trace_rcu_prep_idle("Begin holdoff");
invoke_rcu_core(); /* Force the CPU out of dyntick-idle. */ invoke_rcu_core(); /* Force the CPU out of dyntick-idle. */
return; return;
@ -2154,23 +2147,17 @@ static void rcu_prepare_for_idle(int cpu)
*/ */
#ifdef CONFIG_TREE_PREEMPT_RCU #ifdef CONFIG_TREE_PREEMPT_RCU
if (per_cpu(rcu_preempt_data, cpu).nxtlist) { if (per_cpu(rcu_preempt_data, cpu).nxtlist) {
local_irq_restore(flags);
rcu_preempt_qs(cpu); rcu_preempt_qs(cpu);
force_quiescent_state(&rcu_preempt_state, 0); force_quiescent_state(&rcu_preempt_state, 0);
local_irq_save(flags);
} }
#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
if (per_cpu(rcu_sched_data, cpu).nxtlist) { if (per_cpu(rcu_sched_data, cpu).nxtlist) {
local_irq_restore(flags);
rcu_sched_qs(cpu); rcu_sched_qs(cpu);
force_quiescent_state(&rcu_sched_state, 0); force_quiescent_state(&rcu_sched_state, 0);
local_irq_save(flags);
} }
if (per_cpu(rcu_bh_data, cpu).nxtlist) { if (per_cpu(rcu_bh_data, cpu).nxtlist) {
local_irq_restore(flags);
rcu_bh_qs(cpu); rcu_bh_qs(cpu);
force_quiescent_state(&rcu_bh_state, 0); force_quiescent_state(&rcu_bh_state, 0);
local_irq_save(flags);
} }
/* /*
@ -2178,13 +2165,10 @@ static void rcu_prepare_for_idle(int cpu)
* So try forcing the callbacks through the grace period. * So try forcing the callbacks through the grace period.
*/ */
if (rcu_cpu_has_callbacks(cpu)) { if (rcu_cpu_has_callbacks(cpu)) {
local_irq_restore(flags);
trace_rcu_prep_idle("More callbacks"); trace_rcu_prep_idle("More callbacks");
invoke_rcu_core(); invoke_rcu_core();
} else { } else
local_irq_restore(flags);
trace_rcu_prep_idle("Callbacks drained"); trace_rcu_prep_idle("Callbacks drained");
}
} }
#endif /* #else #if !defined(CONFIG_RCU_FAST_NO_HZ) */ #endif /* #else #if !defined(CONFIG_RCU_FAST_NO_HZ) */