public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Stultz <jstultz@google.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: John Stultz <jstultz@google.com>,
	Anna-Maria Behnsen <anna-maria@linutronix.de>,
	 Frederic Weisbecker <frederic@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	 Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	 Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	 Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	 Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	 Valentin Schneider <vschneid@redhat.com>,
	Stephen Boyd <sboyd@kernel.org>,
	 Yury Norov <yury.norov@gmail.com>,
	Bitao Hu <yaoma@linux.alibaba.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	kernel-team@android.com
Subject: [RFC][PATCH 3/3] Kconfig: Add CONFIG_DYN_HZ_DEFAULT to specify the default dynhz= boot option value
Date: Mon, 27 Jan 2025 22:32:55 -0800	[thread overview]
Message-ID: <20250128063301.3879317-4-jstultz@google.com> (raw)
In-Reply-To: <20250128063301.3879317-1-jstultz@google.com>

Allow a default dynhz= boot option value to be specified via config.

Cc: Anna-Maria Behnsen <anna-maria@linutronix.de>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ben Segall <bsegall@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Valentin Schneider <vschneid@redhat.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Yury Norov <yury.norov@gmail.com>
Cc: Bitao Hu <yaoma@linux.alibaba.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: kernel-team@android.com
Signed-off-by: John Stultz <jstultz@google.com>
---
 kernel/Kconfig.hz         | 10 ++++++++++
 kernel/time/tick-common.c |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/kernel/Kconfig.hz b/kernel/Kconfig.hz
index 76714317674c5..27ad1400ad64e 100644
--- a/kernel/Kconfig.hz
+++ b/kernel/Kconfig.hz
@@ -64,5 +64,15 @@ config DYN_HZ
 	 build time configured HZ value.
 	 If you are unsure, say no.
 
+config DYN_HZ_DEFAULT
+	int "Default DynHZ value (valid range: 100-CONFIG_HZ)"
+	depends on DYN_HZ
+	default HZ
+        range 100 HZ
+	help
+	 Default value for dynhz. This allows ticks to be configured
+	 to arrive at slower than HZ rates. This is useful when you
+	 want to allow boot-time configurable tick rates.
+
 config SCHED_HRTICK
 	def_bool HIGH_RES_TIMERS
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 75fd9dadb8273..46463bfb75d3d 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -81,7 +81,7 @@ int tick_is_oneshot_available(void)
 }
 
 #ifdef CONFIG_DYN_HZ
-long long dyn_tick_nsec = TICK_NSEC;
+long long dyn_tick_nsec = TICK_NSEC * HZ / CONFIG_DYN_HZ_DEFAULT;
 
 static int __init set_dyn_hz(char *str)
 {
-- 
2.48.1.262.g85cc9f2d1e-goog


  parent reply	other threads:[~2025-01-28  6:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28  6:32 [RFC][PATCH 0/3] DynamicHZ: Configuring the timer tick rate at boot time John Stultz
2025-01-28  6:32 ` [RFC][PATCH 1/3] time/tick: Pipe tick count down through cputime accounting John Stultz
2025-01-28 14:44   ` Thomas Gleixner
2025-01-29  4:10     ` John Stultz
2025-01-28  6:32 ` [RFC][PATCH 2/3] time/tick: Introduce a dyn_hz boot option John Stultz
2025-01-28  9:07   ` Peter Zijlstra
2025-01-28 17:29     ` John Stultz
2025-01-28 19:30       ` Peter Zijlstra
2025-01-28  6:32 ` John Stultz [this message]
2025-01-28 16:46 ` [RFC][PATCH 0/3] DynamicHZ: Configuring the timer tick rate at boot time Thomas Gleixner
2025-01-29  6:10   ` John Stultz
2025-01-29  8:09     ` Thomas Gleixner
2025-02-10 16:54       ` David Laight
2025-02-03 11:14   ` Peter Zijlstra
2025-02-10  1:14     ` Qais Yousef
2025-02-10  1:09   ` Qais Yousef

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250128063301.3879317-4-jstultz@google.com \
    --to=jstultz@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=anna-maria@linutronix.de \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=frederic@kernel.org \
    --cc=juri.lelli@redhat.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=yaoma@linux.alibaba.com \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox