Skip to content

Commit e800ac5

Browse files
Kan LiangPeter Zijlstra
authored andcommitted
perf: Only dump the throttle log for the leader
The PERF_RECORD_THROTTLE records are dumped for all throttled events. It's not necessary for group events, which are throttled altogether. Optimize it by only dump the throttle log for the leader. The sample right after the THROTTLE record must be generated by the actual target event. It is good enough for the perf tool to locate the actual target event. Suggested-by: Namhyung Kim <[email protected]> Signed-off-by: Kan Liang <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Namhyung Kim <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9734e25 commit e800ac5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kernel/events/core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,14 +2650,16 @@ static void perf_event_unthrottle(struct perf_event *event, bool start)
26502650
event->hw.interrupts = 0;
26512651
if (start)
26522652
event->pmu->start(event, 0);
2653-
perf_log_throttle(event, 1);
2653+
if (event == event->group_leader)
2654+
perf_log_throttle(event, 1);
26542655
}
26552656

26562657
static void perf_event_throttle(struct perf_event *event)
26572658
{
26582659
event->pmu->stop(event, 0);
26592660
event->hw.interrupts = MAX_INTERRUPTS;
2660-
perf_log_throttle(event, 0);
2661+
if (event == event->group_leader)
2662+
perf_log_throttle(event, 0);
26612663
}
26622664

26632665
static void perf_event_unthrottle_group(struct perf_event *event, bool skip_start_event)

0 commit comments

Comments
 (0)