]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
perf: Optimize perf_pmu_migrate_context()
authorPeter Zijlstra <peterz@infradead.org>
Mon, 3 Apr 2023 09:08:58 +0000 (11:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Apr 2023 15:02:54 +0000 (17:02 +0200)
commit7d7a2abc84b43390dffd6d50ac8c306eab3db4c7
tree6803831c03a40c4caee18c044da16a5156b9403b
parent12b3d75ca3a6ee0dc3b50931ff39d555fd01db5b
perf: Optimize perf_pmu_migrate_context()

[ Upstream commit b168098912926236bbeebaf7795eb7aab76d2b45 ]

Thomas reported that offlining CPUs spends a lot of time in
synchronize_rcu() as called from perf_pmu_migrate_context() even though
he's not actually using uncore events.

Turns out, the thing is unconditionally waiting for RCU, even if there's
no actual events to migrate.

Fixes: 0cda4c023132 ("perf: Introduce perf_pmu_migrate_context()")
Reported-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
Link: https://lkml.kernel.org/r/20230403090858.GT4253@hirez.programming.kicks-ass.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/events/core.c