]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
nohz: Fix another inconsistency between CONFIG_NO_HZ=n and nohz=off
authorThomas Gleixner <tglx@linutronix.de>
Fri, 29 Nov 2013 11:18:13 +0000 (12:18 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 29 Nov 2013 11:23:03 +0000 (12:23 +0100)
If CONFIG_NO_HZ=n tick_nohz_get_sleep_length() returns NSEC_PER_SEC/HZ.

If CONFIG_NO_HZ=y and the nohz functionality is disabled via the
command line option "nohz=off" or not enabled due to missing hardware
support, then tick_nohz_get_sleep_length() returns 0. That happens
because ts->sleep_length is never set in that case.

Set it to NSEC_PER_SEC/HZ when the NOHZ mode is inactive.

Reported-by: Michal Hocko <mhocko@suse.cz>
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/time/tick-sched.c

index a12df5abde0b86cff2971708f5885e2484ac6b97..ea20f7d1ac2c4f91af4dd8dd4db3b01b5c6ae4b7 100644 (file)
@@ -711,8 +711,10 @@ static bool can_stop_idle_tick(int cpu, struct tick_sched *ts)
                return false;
        }
 
-       if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE))
+       if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE)) {
+               ts->sleep_length = (ktime_t) { .tv64 = NSEC_PER_SEC/HZ };
                return false;
+       }
 
        if (need_resched())
                return false;