]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
perf/core: Fix broken throttling when max_samples_per_tick=1
authorQing Wang <wangqing7171@gmail.com>
Sat, 5 Apr 2025 14:16:35 +0000 (22:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:05:10 +0000 (11:05 +0100)
commitfb2671376bbfa22505caf86b4400ce1cc234156c
tree306d6da2ddc8224f9d25e17671524259ec086a2b
parent333f2d85b6155896fdb21d4285f506ed7d1f043e
perf/core: Fix broken throttling when max_samples_per_tick=1

[ Upstream commit f51972e6f8b9a737b2b3eb588069acb538fa72de ]

According to the throttling mechanism, the pmu interrupts number can not
exceed the max_samples_per_tick in one tick. But this mechanism is
ineffective when max_samples_per_tick=1, because the throttling check is
skipped during the first interrupt and only performed when the second
interrupt arrives.

Perhaps this bug may cause little influence in one tick, but if in a
larger time scale, the problem can not be underestimated.

When max_samples_per_tick = 1:
Allowed-interrupts-per-second max-samples-per-second  default-HZ  ARCH
200                           100                     100         X86
500                           250                     250         ARM64
...
Obviously, the pmu interrupt number far exceed the user's expect.

Fixes: e050e3f0a71b ("perf: Fix broken interrupt rate throttling")
Signed-off-by: Qing Wang <wangqing7171@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250405141635.243786-3-wangqing7171@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/events/core.c