public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <jstultz@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Anna-Maria Behnsen <anna-maria@linutronix.de>,
	Frederic Weisbecker <frederic@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	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, Saravana Kannan <saravanak@google.com>,
	Samuel Wu <wusamuel@google.com>, Qais Yousef <qyousef@google.com>
Subject: Re: [RFC][PATCH 0/3] DynamicHZ: Configuring the timer tick rate at boot time
Date: Mon, 10 Feb 2025 16:54:34 +0000	[thread overview]
Message-ID: <20250210165434.0d594c87@pumpkin> (raw)
In-Reply-To: <87a5ba6nz5.ffs@tglx>

On Wed, 29 Jan 2025 09:09:02 +0100
Thomas Gleixner <tglx@linutronix.de> wrote:

> On Tue, Jan 28 2025 at 22:10, John Stultz wrote:
> > On Tue, Jan 28, 2025 at 8:46 AM Thomas Gleixner <tglx@linutronix.de> wrote:  
> >>   1) Jiffies and related timer wheel interfaces
> >>
> >>      jiffies should just go away completely and be replaced by a simple
> >>      millisecond counter, which is accessible in the same way as
> >>      jiffies today.
> >>
> >>      That removes the bulk of HZ usage all over the place and makes the
> >>      usage sites simpler as the interfaces just use SI units and the
> >>      gazillions (~4500 to jiffies and ~1000 from jiffies) back and
> >>      forth conversions just go away.  
> >
> > Yeah, this was basically where I was hoping this would allow us to go.
> > I was imagining once dyn_hz was possible, we could basically fix HZ to
> > 1000 internally, leaving jiffies as that 1ms counter, and let the
> > actual interrupt rate be set via the dynhz default config value.  Then
> > iterating through all the code switching HZ usage to MSEC_PER_SEC, etc
> > would be possible.  
> 
> I strongly suggest to start with exactly this because it significantly
> reduces the problem space and has a valuable benefit in general.

I doubt anyone will notice if a 250Hz timer interrupt always adds 4 to 'jiffies'.

One problem with increasing the frequency of the interrupt is the sheer amount
of code that runs every timer tick.
I suspect most of it is in the scheduler!

Do I recall that the timer wheels no longer move long timers onto the high
resolution wheels?
So longer timers are a much increased granularity.
That is going to be made worse for anyone currently using a 250Hz 'tick'.

Making 'jiffies' milliseconds does stop you having a faster timer tick.
I know one architecture kernel (might not have been Linux) defaulted to 1024Hz.
But I'm not sure that is a problem.

32bit systems must be able to handle wrap - we all know (to our cost) that
a 1ms counter wraps in 48 days. So even a 4ms one wraps quite often.
Although having a 64bit (long) counter in 64bit mode really just hides bugs.

	David




  reply	other threads:[~2025-02-10 16:54 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 ` [RFC][PATCH 3/3] Kconfig: Add CONFIG_DYN_HZ_DEFAULT to specify the default dynhz= boot option value John Stultz
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 [this message]
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=20250210165434.0d594c87@pumpkin \
    --to=david.laight.linux@gmail.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=jstultz@google.com \
    --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=qyousef@google.com \
    --cc=rostedt@goodmis.org \
    --cc=saravanak@google.com \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=wusamuel@google.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