[PATCH 02/32 RESEND] nohz: Drop ts->idle_active

Frederic Weisbecker
2011-08-15T15:52:50Z

ts->idle_active is used to know if we want to account the idle sleep
time. But ts->inidle is enough to check that.

So drop that field and use inidle instead. This simplifies the code.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Anton Blanchard <anton@au1.ibm.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul Menage <menage@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tim Pepper <lnxninja@linux.vnet.ibm.com>
---
include/linux/tick.h | 1 -
kernel/time/tick-sched.c | 14 ++++++--------
2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/include/linux/tick.h b/include/linux/tick.h
index b232ccc..532e650 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -56,7 +56,6 @@ struct tick_sched {
unsigned long idle_jiffies;
unsigned long idle_calls;
unsigned long idle_sleeps;
- int idle_active;
ktime_t idle_entrytime;
ktime_t idle_waketime;
ktime_t idle_exittime;
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 58e1a96..c4d7113 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -157,7 +157,7 @@ update_ts_time_stats(int cpu, struct tick_sched *ts, ktime_t now, u64 *last_upda
{
ktime_t delta;

- if (ts->idle_active) {
+ if (ts->inidle) {
delta = ktime_sub(now, ts->idle_entrytime);
ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
if (nr_iowait_cpu(cpu) > 0)
@@ -175,7 +175,6 @@ static void tick_nohz_stop_idle(int cpu, ktime_t now)
struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);

update_ts_time_stats(cpu, ts, now, NULL);
- ts->idle_active = 0;

sched_clock_idle_wakeup_event(0);
}
@@ -186,7 +185,6 @@ static ktime_t tick_nohz_start_idle(int cpu, struct tick_sched *ts)

now = ktime_get();
ts->idle_entrytime = now;
- ts->idle_active = 1;
sched_clock_idle_sleep_event();
return now;
}
@@ -502,11 +500,11 @@ void tick_nohz_restart_sched_tick(void)
ktime_t now;

local_irq_disable();
- if (ts->idle_active || (ts->inidle && ts->tick_stopped))
- now = ktime_get();

- if (ts->idle_active)
+ if (ts->inidle) {
+ now = ktime_get();
tick_nohz_stop_idle(cpu, now);
+ }

if (!ts->inidle || !ts->tick_stopped) {
ts->inidle = 0;
@@ -677,10 +675,10 @@ static inline void tick_check_nohz(int cpu)
struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
ktime_t now;

- if (!ts->idle_active && !ts->tick_stopped)
+ if (!ts->inidle && !ts->tick_stopped)
return;
now = ktime_get();
- if (ts->idle_active)
+ if (ts->inidle)
tick_nohz_stop_idle(cpu, now);
if (ts->tick_stopped) {
tick_nohz_update_jiffies(now);
--
1.7.5.4