Re: [RFC v2] perf: Rewrite core context handling
From: Ravi Bangoria
Date: Thu Aug 25 2022 - 01:39:26 EST
> -static inline int __pmu_filter_match(struct perf_event *event)
> -{
> - struct pmu *pmu = event->pmu;
> - return pmu->filter_match ? pmu->filter_match(event) : 1;
> -}
> -
> -/*
> - * Check whether we should attempt to schedule an event group based on
> - * PMU-specific filtering. An event group can consist of HW and SW events,
> - * potentially with a SW leader, so we must check all the filters, to
> - * determine whether a group is schedulable:
> - */
> -static inline int pmu_filter_match(struct perf_event *event)
> -{
> - struct perf_event *sibling;
> -
> - if (!__pmu_filter_match(event))
> - return 0;
> -
> - for_each_sibling_event(sibling, event) {
> - if (!__pmu_filter_match(sibling))
> - return 0;
> - }
> -
> - return 1;
> -}
> -
> static inline int
> event_filter_match(struct perf_event *event)
> {
> return (event->cpu == -1 || event->cpu == smp_processor_id()) &&
> - perf_cgroup_match(event) && pmu_filter_match(event);
> + perf_cgroup_match(event);
There are many callers of event_filter_match() which might not endup calling
visit_groups_merge(). I hope this is intentional change?
> }
>
> static void
> @@ -3661,6 +3634,9 @@ static noinline int visit_groups_merge(struct perf_event_context *ctx,
> struct perf_event **evt;
> int ret;
>
> + if (pmu->filter && pmu->filter(pmu, cpu))
> + return 0;
> +
> if (!ctx->task) {
> cpuctx = this_cpu_ptr(&cpu_context);
> event_heap = (struct min_heap){
Thanks,
Ravi