Re: [RFC][PATCH 2/3] time/tick: Introduce a dyn_hz boot option
From: Peter Zijlstra
Date: Tue Jan 28 2025 - 04:07:58 EST
On Mon, Jan 27, 2025 at 10:32:54PM -0800, John Stultz wrote:
> Introduce dyn_hz= option, which allows the actual timer tick to
> be scaled down at boot time.
>
> This allows kerenls to be built with HZ=1000 but systems to
> effectively run as if HZ=100 if specified.
>
> The system will still run with the configured HZ value, but
> ticks will just arrive "late".
>
> The valid values are between 100 and the build time CONFIG_HZ
> value.
>
> Signed-off-by: John Stultz <jstultz@xxxxxxxxxx>
> ---
> include/linux/tick.h | 11 +++++++++--
> kernel/Kconfig.hz | 9 +++++++++
> kernel/time/tick-common.c | 30 ++++++++++++++++++++++++++++++
> kernel/time/tick-sched.c | 4 ++--
> 4 files changed, 50 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/tick.h b/include/linux/tick.h
> index b8ddc8e631a3c..734ee1e08c9ef 100644
> --- a/include/linux/tick.h
> +++ b/include/linux/tick.h
> @@ -14,6 +14,13 @@
> #include <linux/rcupdate.h>
> #include <linux/static_key.h>
>
> +#ifdef CONFIG_DYN_HZ
> +extern long long dyn_tick_nsec;
> +#define DYN_TICK_NSEC (dyn_tick_nsec)
> +#else
> +#define DYN_TICK_NSEC TICK_NSEC
> +#endif
My git-grep TICK_NSEC spies a whole bunch of TICK_NSEC users that seem
sad now.
That is, why don't they all need updating?