From: Frederic Weisbecker <frederic@kernel.org>
To: Stian Halseth <stian@itx.no>
Cc: 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: Sun, 1 Nov 2026 00:11:32 +0100 [thread overview]
Message-ID: <auZ1pISMUGbXSlbp@pavilion.home> (raw)
In-Reply-To: <20261031081408.3378884-1-stian@itx.no>
Le Sat, Oct 31, 2026 at 09:14:07AM +0100, Stian Halseth a écrit :
> kcpustat_dyntick_stop() warns if idle ends before the tick period
> that the next tick will account has started. That happens on x86 in
> a CPU's first idle period with the tick stopped, right after the
> switch from the jiffies clocksource to tsc-early.
>
> On the jiffies clocksource ktime only moves at the tick. When the
> clocksource switches some time d after a tick, that d is lost: ktime
> continues from the value of the last tick. The next tick comes
> TICK_NSEC after the last one, but ktime has only moved TICK_NSEC - d,
> while tick_periodic() still adds a full TICK_NSEC to tick_next_period,
> which is now d ahead of ktime. When NOHZ starts,
> tick_init_jiffy_update() rounds it up to a multiple of TICK_NSEC and
> the sched timer is armed there, up to nearly two ticks after now. A
> tick stop saves that as ts->last_tick, and an idle exit before now
> reaches ts->last_tick - TICK_NSEC sees the tick period in the future.
>
> Nothing is accounted twice then. The first tick covers a period that
> starts after the idle exit, and the code already handles it. Drop the
> warning.
>
> Fixes: 96a494c9cfd8 ("sched/cputime: Don't account idle time twice after dyntick-idle")
> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
> Closes: https://lore.kernel.org/all/bfe9b14a-6e65-41c5-b638-26f6e033788b@molgen.mpg.de/
> Reported-by: Breno Leitao <leitao@debian.org>
> Link: https://lore.kernel.org/all/auTCQauaU733PY5z@gmail.com/
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> Link: https://lore.kernel.org/all/CAHk-=winC2u2D1FAX5grfq9F=bxmARxhuiQ4MvHAiJFu3iF6gw@mail.gmail.com/
> Signed-off-by: Stian Halseth <stian@itx.no>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Thanks!
--
Frederic Weisbecker
SUSE Labs
next prev parent reply other threads:[~2026-10-31 23:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 8:14 Stian Halseth
2026-10-31 11:47 ` Kayra Cizmeci
2026-10-31 12:15 ` Stian Halseth
2026-10-31 23:11 ` Frederic Weisbecker [this message]
2026-11-01 6:50 ` [tip: sched/urgent] " tip-bot2 for 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=auZ1pISMUGbXSlbp@pavilion.home \
--to=frederic@kernel.org \
--cc=anna-maria@linutronix.de \
--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®