lkml.org 
[lkml]   [2019]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH v5 09/10] perf: optimize event_filter_match during sched_in
From
The caller verified the CPU and cgroup so directly call
pmu_filter_match.

Signed-off-by: Ian Rogers <irogers@google.com>
---
kernel/events/core.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 5935d2474050..bcaf100d8167 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2227,8 +2227,11 @@ static inline int pmu_filter_match(struct perf_event *event)
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);
+ if (event->cpu != -1 && event->cpu != smp_processor_id())
+ return 0;
+ if (!perf_cgroup_match(event))
+ return 0;
+ return pmu_filter_match(event);
}

static void
@@ -3577,7 +3580,11 @@ static int merge_sched_in(struct perf_event_context *ctx,
if (event->state <= PERF_EVENT_STATE_OFF)
return 0;

- if (!event_filter_match(event))
+ /*
+ * Avoid full event_filter_match as the caller verified the CPU and
+ * cgroup before calling.
+ */
+ if (!pmu_filter_match(event))
return 0;

if (group_can_go_on(event, cpuctx, 1)) {
--
2.24.0.393.g34dc348eaf-goog
\
 
 \ /
  Last update: 2019-12-07 00:16    [W:0.221 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site