[PATCH 05/32] nohz: Move rcu dynticks idle mode handling to idle enter/exit APIs

From: Frederic Weisbecker
Date: Mon Aug 15 2011 - 11:53:04 EST


To prepare for nohz / idle logic split, pull out the rcu dynticks
idle mode switching to strict idle entry/exit areas.

So we make the dyntick mode possible without always involving rcu
extended quiescent state.

Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Anton Blanchard <anton@xxxxxxxxxxx>
Cc: Avi Kivity <avi@xxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
Cc: Paul E . McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Cc: Paul Menage <menage@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Stephen Hemminger <shemminger@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Tim Pepper <lnxninja@xxxxxxxxxxxxxxxxxx>
---
kernel/time/tick-sched.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index df6bb4c..8937d4a 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -385,7 +385,6 @@ static void tick_nohz_stop_sched_tick(ktime_t now)
ts->idle_tick = hrtimer_get_expires(&ts->sched_timer);
ts->tick_stopped = 1;
ts->idle_jiffies = last_jiffies;
- rcu_enter_nohz();
}

ts->idle_sleeps++;
@@ -429,9 +428,13 @@ out:
static void __tick_nohz_enter_idle(struct tick_sched *ts, int cpu)
{
ktime_t now;
+ int was_stopped = ts->tick_stopped;

now = tick_nohz_start_idle(cpu, ts);
tick_nohz_stop_sched_tick(now);
+
+ if (!was_stopped && ts->tick_stopped)
+ rcu_enter_nohz();
}

void tick_nohz_enter_idle(void)
@@ -499,8 +502,6 @@ static void tick_nohz_restart_sched_tick(ktime_t now, struct tick_sched *ts)
unsigned long ticks;
#endif

- rcu_exit_nohz();
-
/* Update jiffies first */
select_nohz_load_balancer(0);
tick_do_update_jiffies64(now);
@@ -547,8 +548,10 @@ void tick_nohz_exit_idle(void)
tick_nohz_stop_idle(smp_processor_id(), now);
ts->inidle = 0;

- if (ts->tick_stopped)
+ if (ts->tick_stopped) {
+ rcu_exit_nohz();
tick_nohz_restart_sched_tick(now, ts);
+ }

local_irq_enable();
}
--
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/