Re: [request for stable inclusion] nohz: Fix another inconsistency between CONFIG_NO_HZ=n and nohz=off

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 24, 2014 at 12:02:34PM +0800, Rui Xiang wrote:
> Hi Greg or Thomas,
> 
> 0e576acbc1d9600cf2d9b4a141a2554639959d50 
> nohz: Fix another inconsistency between CONFIG_NO_HZ=n and nohz=off
> 
> This fixed an inconsistency about nohz. 
> 
> Without this patch, When we boot with nohz=off and CONFIG_NO_HZ=Y, 
> and the system is idle, powertop shows the cpu is always in polling
> state. It can affect the performance in some cases. 
> 
> *without patch*
>      PowerTOP version 1.13      (C) 2007 Intel Corporation
> 
> Cn                Avg residency       P-states (frequencies)
> C0 (cpu running)        ( 0.0%)       Turbo Mode     0.0%
> polling          70.3ms (100.3%)        2.40 Ghz     0.0%
> C1 mwait          0.0ms ( 0.0%)         2.27 Ghz     0.0%
> C2 mwait          0.0ms ( 0.0%)         2.14 Ghz     0.0%
> C3 mwait          0.0ms ( 0.0%)         1.60 Ghz   100.0%
> 
> *with patch*
>      PowerTOP version 1.13      (C) 2007 Intel Corporation
> 
> Cn                Avg residency       P-states (frequencies)
> C0 (cpu running)        ( 0.3%)       Turbo Mode     0.0%
> polling           0.0ms ( 0.0%)         2.40 Ghz     0.0%
> C1 mwait          0.0ms ( 0.0%)         2.27 Ghz     0.0%
> C2 mwait          0.0ms ( 0.0%)         2.14 Ghz     0.0%
> C3 mwait          3.9ms (99.7%)         1.60 Ghz   100.0%
> 
> 
> This patch looks applicable to stable-3.4 and stable 3.10. It can be
> applyed to 3.10 cleanly, but should be added some adjustment for 3.4.
> 
> And what do you think?
> 
> Thanks,
> Rui

Thank you Rui, I'll queue it for the 3.11 kernel as well.

Cheers,
--
Luís

> 
> -----------------------
> 
> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> 
> commit 0e576acbc1d9600cf2d9b4a141a2554639959d50 upstream
> 
> 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@xxxxxxx>
> Reported-by: Borislav Petkov <bp@xxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> [xr: Backported to 3.4:
>   - applied the change to tick_nohz_stop_sched_tick() instead of
>     can_stop_idle_tick]
> Signed-off-by: Rui Xiang <rui.xiang@xxxxxxxxxx>
> ---
>  kernel/time/tick-sched.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index 638dadf..67106f8 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -296,8 +296,10 @@ static void tick_nohz_stop_sched_tick(struct tick_sched *ts)
>  			tick_do_timer_cpu = TICK_DO_TIMER_NONE;
>  	}
>  
> -	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;
> +	}
>  
>  	if (need_resched())
>  		return;
> -- 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]