lkml.org 
[lkml]   [2019]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[PATCH v3 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 | 19 +++++++++++++++----
    1 file changed, 15 insertions(+), 4 deletions(-)

    diff --git a/kernel/events/core.c b/kernel/events/core.c
    index 9f0febf51d97..99ac8248a9b6 100644
    --- a/kernel/events/core.c
    +++ b/kernel/events/core.c
    @@ -2196,8 +2196,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
    @@ -3632,7 +3635,11 @@ static int pinned_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)) {
    @@ -3658,7 +3665,11 @@ static int flexible_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, *can_add_hw)) {
    --
    2.24.0.432.g9d3f5f5b63-goog
    \
     
     \ /
      Last update: 2019-11-14 01:32    [W:3.004 / U:0.912 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site