nohz: Drop useless call in tick_nohz_start_idle()
PATCH 1/2 nohz: Drop useless call in tick_nohz_start_idle()
The call to update_ts_time_stats() there is useless. All we need is to save the idle entry_time.
--- kernel/time/tick-sched.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
kernel/time/tick-sched.c +0 -3
@@ -185,9 +185,6 @@ static ktime_t tick_nohz_start_idle(int cpu, struct tick_sched *ts)ktime_t now; now =ktime_get (); - -update_ts_time_stats (cpu, ts, now,NULL ); - ts->idle_entrytime = now; ts->idle_active =1 ;sched_clock_idle_sleep_event ();
Signature · 1 line
1.7.5.4
PATCH 2/2 nohz: Drop ts->idle_active
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.
--- include/linux/tick.h | 1 - kernel/time/tick-sched.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-)
include/linux/tick.h +0 -1
@@ -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;
kernel/time/tick-sched.c +6 -8
@@ -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);
Signature · 1 line
1.7.5.4
[PATCH 3/2] nohz: Drop useless ts->inidle check before rearming the tick
In reply to Frederic WeisbeckerWe only need to check if we have ts->stopped to ensure the tick was stopped and we want to re-enable it. Checking ts->inidle there is useless.
--- kernel/time/tick-sched.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
kernel/time/tick-sched.c +2 -4
@@ -504,16 +504,14 @@ void tick_nohz_restart_sched_tick(void)if (ts->inidle) { now =ktime_get ();tick_nohz_stop_idle (cpu, now); + ts->inidle =0 ; } -if (!ts->inidle || !ts->tick_stopped) { - ts->inidle =0 ; +if (!ts->tick_stopped) {local_irq_enable ();return ; } - ts->inidle =0 ; -rcu_exit_nohz ();/* Update jiffies first */
Signature · 1 line
1.7.5.4
Ping? No problem with these three patches?
Quoted 28 lines · Frederic Weisbecker
The call to
update_ts_time_stats()there is useless. All we need is to save the idleentry_time.Signed-off-by Frederic Weisbecker <[email protected]>Cc Ingo Molnar <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Peter Zijlstra <[email protected]>--- kernel/time/tick-sched.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)kernel/time/tick-sched.c +0
-3@@ -185,9 +185,6 @@ static ktime_t tick_nohz_start_idle(int cpu, struct tick_sched *ts)ktime_t now; now =ktime_get (); - -update_ts_time_stats (cpu, ts, now,NULL ); - ts->idle_entrytime = now; ts->idle_active =1 ;sched_clock_idle_sleep_event ();Signature · 1 line
1.7.5.4
Forget these patches. Peterz found that the 2nd one is buggy and I need to refine the others changelog.
Thnaks.
Quoted 28 lines · Frederic Weisbecker
The call to
update_ts_time_stats()there is useless. All we need is to save the idleentry_time.Signed-off-by Frederic Weisbecker <[email protected]>Cc Ingo Molnar <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Peter Zijlstra <[email protected]>--- kernel/time/tick-sched.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)kernel/time/tick-sched.c +0
-3@@ -185,9 +185,6 @@ static ktime_t tick_nohz_start_idle(int cpu, struct tick_sched *ts)ktime_t now; now =ktime_get (); - -update_ts_time_stats (cpu, ts, now,NULL ); - ts->idle_entrytime = now; ts->idle_active =1 ;sched_clock_idle_sleep_event ();Signature · 1 line
1.7.5.4