* [PATCH] perf/core: Accumulate lost samples in inherited group reads
@ 2026-11-15 15:14 Avi Weiss
0 siblings, 0 replies; only message in thread
From: Avi Weiss @ 2026-11-15 15:14 UTC (permalink / raw)
To: peterz, namhyung
Cc: mingo, acme, mark.rutland, jolsa, linux-perf-users, linux-kernel
`__perf_read_group_add()` accumulates event counts from inherited
child events, but overwrites the `PERF_FORMAT_LOST` fields. A
child reporting no losses therefore hides nonzero parent losses
while it is alive.
Accumulate `lost_samples` for the group leader and siblings so
group reads preserve losses across inherited events.
Fixes: 119a784c8127 ("perf/core: Add a new read format to get a number of lost samples")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
kernel/events/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 457d75ea7142..165eb55608b6 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6163,14 +6163,14 @@ static int __perf_read_group_add(struct perf_event *leader,
if (read_format & PERF_FORMAT_ID)
values[n++] = primary_event_id(leader);
if (read_format & PERF_FORMAT_LOST)
- values[n++] = atomic64_read(&leader->lost_samples);
+ values[n++] += atomic64_read(&leader->lost_samples);
for_each_sibling_event(sub, leader) {
values[n++] += perf_event_count(sub, false);
if (read_format & PERF_FORMAT_ID)
values[n++] = primary_event_id(sub);
if (read_format & PERF_FORMAT_LOST)
- values[n++] = atomic64_read(&sub->lost_samples);
+ values[n++] += atomic64_read(&sub->lost_samples);
}
unlock:
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-15 15:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-15 15:14 [PATCH] perf/core: Accumulate lost samples in inherited group reads Avi Weiss
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®