]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
perf: Optimize context reschedule for single PMU cases
authorPeter Zijlstra <peterz@infradead.org>
Wed, 7 Aug 2024 11:29:25 +0000 (13:29 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 8 Aug 2024 10:27:31 +0000 (12:27 +0200)
commit2d17cf1abcbe8a45b7dc41a768ed22aac158ddd8
tree564e319ce034c31f897a7fbcc1251cb7cb4a2ee8
parentea1992f36b894fe60cc3537a7f6a7af4087b999a
perf: Optimize context reschedule for single PMU cases

Currently re-scheduling a context will reschedule all active PMUs for
that context, even if it is known only a single event is added.

Namhyung reported that changing this to only reschedule the affected
PMU when possible provides significant performance gains under certain
conditions.

Therefore, allow partial context reschedules for a specific PMU, that
of the event modified.

While the patch looks somewhat noisy, it mostly just propagates a new
@pmu argument through the callchain and modifies the epc loop to only
pick the 'epc->pmu == @pmu' case.

Reported-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240807115549.920950699@infradead.org
kernel/events/core.c