tick/sched: Drop duplicated tick_sched.inidle
PATCH 1/1 tick/sched: Drop duplicated tick_sched.inidle
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.
--- kernel/time/tick-sched.c | 11 ++++------- kernel/time/tick-sched.h | 3 +-- 2 files changed, 5 insertions(+), 9 deletions(-)
kernel/time/tick-sched.c +4 -7
@@ -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;
kernel/time/tick-sched.h +1 -2
@@ -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;
Signature · 1 line
2.17.1
Frederic Weisbecker
maintainerQuoted 3 lines · Peter Xu
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.
Not exactly.
@inidle is set on idle entry and cleared on idle exit. @idle_active is the same but it's cleared during idle interrupts so that idle_sleeptime only account real idle time.
And note below:
kernel/time/tick-sched.c void tick_nohz_irq_exit(void) · line 1019
Quoted 7 lines
kernel/time/tick-sched.c +1
-1@@ -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);
idle_active will always be cleared here from tick_nohz_irq_enter(). We actually want to conditionally set it again depending on the inidle value.
Thanks.
Quoted 17 lines · Frederic Weisbecker
Quoted 3 lines · Peter Xu
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.
Not exactly.
@inidle is set on idle entry and cleared on idle exit. @idle_active is the same but it's cleared during idle interrupts so that
idle_sleeptimeonly account real idle time.And note below:
Quoted 4 lines
kernel/time/tick-sched.c +0
-0@@ -1017,7 +1015,7 @@ void tick_nohz_irq_exit(void) {struct tick_sched *ts =this_cpu_ptr (&tick_cpu_sched);
Quoted 6 lines
kernel/time/tick-sched.c void tick_nohz_irq_exit(void) · line 1019
Quoted 3 lines
kernel/time/tick-sched.c +1
-1-if (ts->inidle) +if (ts->idle_active)tick_nohz_start_idle (ts);
idle_activewill always be cleared here fromtick_nohz_irq_enter(). We actually want to conditionally set it again depending on the inidle value.
You are right; I've missed the calls from irq enter/exit. Thanks, Frederic.
Signature · 1 line
Peter Xu