Messages in this thread Patch in this message |  | | From | David Carrillo-Cisneros <> | Subject | [PATCH v3 34/46] perf/core: introduce PERF_EV_CAP_CGROUP_NO_RECURSION | Date | Sat, 29 Oct 2016 17:38:31 -0700 |
| |
The generic code handles cgroup hierarchy by adding to the PMU the events of all the ancestor cgroups of the cgroup to read. This approach is incompatible with the CMT hw that only allows one rmid per virtual core at a time. CMT's PMU work-arounds this limitation by internally maintaining the hierarchical dependency between monitored cgroups (the monr hierarchy).
The flag introduced in this patch signals the generic code that this cgroup event do not need to add ancestor's event recursively.
Signed-off-by: David Carrillo-Cisneros <davidcc@google.com> --- include/linux/perf_event.h | 5 +++++ kernel/events/core.c | 3 +++ 2 files changed, 8 insertions(+)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 72fe105..3b1d542 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -522,11 +522,16 @@ typedef void (*perf_overflow_handler_t)(struct perf_event *, * * PERF_EV_CAP_READ_ANY_PKG: An event readable from any CPU in any package, * even if inactive. + * + * PERF_EV_CAP_CGROUP_NO_RECURSION: A cgroup event that handles its own + * cgroup scoping. It does not need to be enabled for all of its descendants + * cgroups. */ #define PERF_EV_CAP_SOFTWARE BIT(0) #define PERF_EV_CAP_READ_ACTIVE_PKG BIT(1) #define PERF_EV_CAP_READ_ANY_CPU_PKG BIT(2) #define PERF_EV_CAP_READ_ANY_PKG BIT(3) +#define PERF_EV_CAP_CGROUP_NO_RECURSION BIT(4) #define SWEVENT_HLIST_BITS 8 #define SWEVENT_HLIST_SIZE (1 << SWEVENT_HLIST_BITS) diff --git a/kernel/events/core.c b/kernel/events/core.c index 77afd68..4f43c75 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -590,6 +590,9 @@ perf_cgroup_match(struct perf_event *event) if (!cpuctx->cgrp) return false; + if (event->event_caps & PERF_EV_CAP_CGROUP_NO_RECURSION) + return cpuctx->cgrp->css.cgroup == event->cgrp->css.cgroup; + /* * Cgroup scoping is recursive. An event enabled for a cgroup is * also enabled for all its descendant cgroups. If @cpuctx's -- 2.8.0.rc3.226.g39d4020
|  |