summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/allocator.rs
diff options
context:
space:
mode:
authorStian Halseth <stian@itx.no>2026-10-31 09:14:07 +0100
committerIngo Molnar <mingo@kernel.org>2026-11-01 07:32:38 +0100
commitb327e63683a2b894b500027375342c25222b58ef (patch)
tree76d2833e913cc15df4b96d3263c97707c9bcb358 /rust/kernel/alloc/allocator.rs
parentcbbddb6b08cc9900a87cccaa9b22bbe06aa4f50a (diff)
downloadlinux-b327e63683a2b894b500027375342c25222b58ef.tar.gz
linux-b327e63683a2b894b500027375342c25222b58ef.zip
sched/cputime: Don't warn when the tick period starts after idle exit
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> Reported-by: Breno Leitao <leitao@debian.org> Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Stian Halseth <stian@itx.no> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/all/auTCQauaU733PY5z@gmail.com/ Link: https://lore.kernel.org/all/CAHk-=winC2u2D1FAX5grfq9F=bxmARxhuiQ4MvHAiJFu3iF6gw@mail.gmail.com/ Link: https://patch.msgid.link/20261031081408.3378884-1-stian@itx.no Closes: https://lore.kernel.org/all/bfe9b14a-6e65-41c5-b638-26f6e033788b@molgen.mpg.de/ -- kernel/sched/cputime.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Diffstat (limited to 'rust/kernel/alloc/allocator.rs')
0 files changed, 0 insertions, 0 deletions