Skip to content

Commit faf8f41

Browse files
committed
Merge tag 'perf_urgent_for_v6.3_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Borislav Petkov: - Fix "same task" check when redirecting event output - Do not wait unconditionally for RCU on the event migration path if there are no events to migrate * tag 'perf_urgent_for_v6.3_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/core: Fix the same task check in perf_event_set_output perf: Optimize perf_pmu_migrate_context()
2 parents 4ba115e + 24d3ae2 commit faf8f41

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

kernel/events/core.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12173,7 +12173,7 @@ perf_event_set_output(struct perf_event *event, struct perf_event *output_event)
1217312173
/*
1217412174
* If its not a per-cpu rb, it must be the same task.
1217512175
*/
12176-
if (output_event->cpu == -1 && output_event->ctx != event->ctx)
12176+
if (output_event->cpu == -1 && output_event->hw.target != event->hw.target)
1217712177
goto out;
1217812178

1217912179
/*
@@ -12893,12 +12893,14 @@ void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)
1289312893
__perf_pmu_remove(src_ctx, src_cpu, pmu, &src_ctx->pinned_groups, &events);
1289412894
__perf_pmu_remove(src_ctx, src_cpu, pmu, &src_ctx->flexible_groups, &events);
1289512895

12896-
/*
12897-
* Wait for the events to quiesce before re-instating them.
12898-
*/
12899-
synchronize_rcu();
12896+
if (!list_empty(&events)) {
12897+
/*
12898+
* Wait for the events to quiesce before re-instating them.
12899+
*/
12900+
synchronize_rcu();
1290012901

12901-
__perf_pmu_install(dst_ctx, dst_cpu, pmu, &events);
12902+
__perf_pmu_install(dst_ctx, dst_cpu, pmu, &events);
12903+
}
1290212904

1290312905
mutex_unlock(&dst_ctx->mutex);
1290412906
mutex_unlock(&src_ctx->mutex);

0 commit comments

Comments
 (0)