Messages in this thread Patch in this message | | | From | Chengming Zhou <> | Subject | [PATCH v2 6/6] perf/core: Don't need event_filter_match when merge_sched_in() | Date | Tue, 22 Mar 2022 20:08:34 +0800 |
| |
There are two obselete comments in perf_cgroup_switch(), since we don't use event_filter_match() when event_sched_out(). And found we needn't to use event_filter_match() when sched_in too.
Because now we use the perf_event groups RB-tree to get the exact matched perf_events, don't need to go through the event_filter_match() to check if matched.
We can remove it in merge_sched_in() actually, but this patch changes it to a WARN_ON_ONCE for debug purpose, and found no warning in our stress test.
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com> --- kernel/events/core.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c index 4c8657b08301..744078fe2819 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -860,15 +860,11 @@ static void perf_cgroup_switch(struct task_struct *task) perf_pmu_disable(cpuctx->ctx.pmu); cpu_ctx_sched_out(cpuctx, EVENT_ALL); - /* - * must not be done before ctxswout due - * to event_filter_match() in event_sched_out() - */ cpuctx->cgrp = cgrp; /* * set cgrp before ctxsw in to allow - * event_filter_match() to not have to pass - * task around + * visit_groups_merge() to find matched + * cgroup events */ cpu_ctx_sched_in(cpuctx, EVENT_ALL); @@ -3729,7 +3725,7 @@ static int merge_sched_in(struct perf_event *event, void *data) if (event->state <= PERF_EVENT_STATE_OFF) return 0; - if (!event_filter_match(event)) + if (WARN_ON_ONCE(!event_filter_match(event))) return 0; if (group_can_go_on(event, cpuctx, *can_add_hw)) { -- 2.20.1
| |