All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf/core: Accumulate lost samples in inherited group reads
@ 2026-11-15 15:14 Avi Weiss
  2026-11-15 15:22 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages 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 related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-15 15:22 UTC | newest]

Thread overview: 2+ messages (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
2026-11-15 15:22 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.