Re: [RFC] perf/core: Add an ioctl to get a number of lost samples

From: Andi Kleen
Date: Wed Aug 11 2021 - 09:12:29 EST



diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f5a6a2f069ed..44d72079c77a 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -756,6 +756,8 @@ struct perf_event {
struct pid_namespace *ns;
u64 id;
+ atomic_t lost_samples;

Would rather use atomic64_t. atomic_t might wrap too quickly.

But it might be better to put it somewhere where you already have a lock on the event, then you wouldn't need an atomic.

-Andi