[PATCH] tick/sched: Drop duplicated tick_sched.inidle

From: Peter Xu
Date: Tue May 21 2019 - 23:31:50 EST


It is set before entering idle and cleared when quitting idle, though
it seems to be a complete duplicate of tick_sched.idle_active. We
should probably be able to use any one of them to replace the other.

CC: Frederic Weisbecker <fweisbec@xxxxxxxxx>
CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CC: Ingo Molnar <mingo@xxxxxxxxxx>
CC: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
---
kernel/time/tick-sched.c | 11 ++++-------
kernel/time/tick-sched.h | 3 +--
2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index f4ee1a3428ae..6bb5ad03e962 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -137,7 +137,7 @@ static void tick_sched_do_timer(struct tick_sched *ts, ktime_t now)
if (tick_do_timer_cpu == cpu)
tick_do_update_jiffies64(now);

- if (ts->inidle)
+ if (ts->idle_active)
ts->got_idle_tick = 1;
}

@@ -534,7 +534,6 @@ static void tick_nohz_stop_idle(struct tick_sched *ts, ktime_t now)
{
update_ts_time_stats(smp_processor_id(), ts, now, NULL);
ts->idle_active = 0;
-
sched_clock_idle_wakeup_event();
}

@@ -999,7 +998,6 @@ void tick_nohz_idle_enter(void)

WARN_ON_ONCE(ts->timer_expires_base);

- ts->inidle = 1;
tick_nohz_start_idle(ts);

local_irq_enable();
@@ -1017,7 +1015,7 @@ void tick_nohz_irq_exit(void)
{
struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);

- if (ts->inidle)
+ if (ts->idle_active)
tick_nohz_start_idle(ts);
else
tick_nohz_full_update_tick(ts);
@@ -1067,7 +1065,7 @@ ktime_t tick_nohz_get_sleep_length(ktime_t *delta_next)
ktime_t now = ts->idle_entrytime;
ktime_t next_event;

- WARN_ON_ONCE(!ts->inidle);
+ WARN_ON_ONCE(!ts->idle_active);

*delta_next = ktime_sub(dev->next_event, now);

@@ -1163,10 +1161,9 @@ void tick_nohz_idle_exit(void)

local_irq_disable();

- WARN_ON_ONCE(!ts->inidle);
+ WARN_ON_ONCE(!ts->idle_active);
WARN_ON_ONCE(ts->timer_expires_base);

- ts->inidle = 0;
idle_active = ts->idle_active;
tick_stopped = ts->tick_stopped;

diff --git a/kernel/time/tick-sched.h b/kernel/time/tick-sched.h
index 4fb06527cf64..ae9335d019f0 100644
--- a/kernel/time/tick-sched.h
+++ b/kernel/time/tick-sched.h
@@ -31,7 +31,7 @@ enum tick_nohz_mode {
* @idle_active: Indicator that the CPU is actively in the tick idle mode;
* it is resetted during irq handling phases.
* @do_timer_lst: CPU was the last one doing do_timer before going idle
- * @got_idle_tick: Tick timer function has run with @inidle set
+ * @got_idle_tick: Tick timer function has run with @idle_active set
* @last_tick: Store the last tick expiry time when the tick
* timer is modified for nohz sleeps. This is necessary
* to resume the tick timer operation in the timeline
@@ -55,7 +55,6 @@ struct tick_sched {
unsigned long check_clocks;
enum tick_nohz_mode nohz_mode;

- unsigned int inidle : 1;
unsigned int tick_stopped : 1;
unsigned int idle_active : 1;
unsigned int do_timer_last : 1;
--
2.17.1