[PATCH v8 1/5] perf: Add a counter for number of user access events in context

From: Rob Herring
Date: Mon May 17 2021 - 15:54:18 EST


When scheduling a task's context, we need to know if the task has any
user accessible events in order to enable or disable user access.
Walking the context's list of events would be slow, so add a counter
to track this.

Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
---
include/linux/perf_event.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f5a6a2f069ed..4cf081e22b76 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -822,6 +822,7 @@ struct perf_event_context {
int nr_stat;
int nr_freq;
int rotate_disable;
+ atomic_t nr_user;
/*
* Set when nr_events != nr_active, except tolerant to events not
* necessary to be active due to scheduling constraints, such as cgroups.
--
2.27.0