From: Kayra Cizmeci <kayracizmeci@gmail.com>
To: Stian Halseth <stian@itx.no>
Cc: Frederic Weisbecker <frederic@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Paul Menzel <pmenzel@molgen.mpg.de>,
Breno Leitao <leitao@debian.org>,
Thorsten Leemhuis <linux@leemhuis.info>,
Thomas Gleixner <tglx@kernel.org>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Shrikanth Hegde <sshegde@linux.ibm.com>,
regressions@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sched/cputime: Don't warn when the tick period starts after idle exit
Date: Sat, 31 Oct 2026 14:47:41 +0300 [thread overview]
Message-ID: <auW3XbhjMjakWAhT@scheduler.schedules> (raw)
In-Reply-To: <20261031081408.3378884-1-stian@itx.no>
On Sat, Oct 31, 2026 at 09:14:07AM +0100, Stian Halseth wrote:
> kernel/sched/cputime.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
> index 9e0fb8633d823..17f3cbd5d403a 100644
> --- a/kernel/sched/cputime.c
> +++ b/kernel/sched/cputime.c
> @@ -478,7 +478,12 @@ void kcpustat_dyntick_stop(u64 now, u64 tick_start)
> kc->idle_tick_overlap = 0;
> }
> tick_start = max(tick_start, kc->idle_dyntick_entry);
> - if (!WARN_ON_ONCE(now < tick_start))
> + /*
> + * After a switch from the jiffies clocksource the tick can be
> + * armed more than a tick ahead, so the period may not have
> + * started yet.
> + */
> + if (now > tick_start)
> kc->idle_tick_overlap += now - tick_start;
> kcpustat_idle_stop(kc, now);
> kc->idle_dyntick = false;
> --
> 2.43.0
TICK_NSEC = 4
switch
|
v
Real: 8 9 10 11 12 13 14 15 16 17 18
Time: 8 8 8 9 10 11 12 13 14 15 16
Tick: 8 8 8 8 10 10 10 10 10 10 16
So if we enter idle at real-12, and exit at real-13 this happens:
last_tick is 16, so last_tick - 4 = 12. But normally, last_tick needs to
be 14 and tick_start needs to be 10. Or am I missing something?
IDK if there is a better solution tho.
Maybe fixing it from the root would be better. If its even possible to do it
cleanly...
But this code works correct.
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Thanks,
Kayra
next prev parent reply other threads:[~2026-10-31 11:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 8:14 Stian Halseth
2026-10-31 11:47 ` Kayra Cizmeci [this message]
2026-10-31 12:15 ` Stian Halseth
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=auW3XbhjMjakWAhT@scheduler.schedules \
--to=kayracizmeci@gmail.com \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@leemhuis.info \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=pmenzel@molgen.mpg.de \
--cc=regressions@lists.linux.dev \
--cc=sshegde@linux.ibm.com \
--cc=stian@itx.no \
--cc=tglx@kernel.org \
--cc=torvalds@linux-foundation.org \
/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
all inboxes | Powered by JetHome®