diff options
author | Peter Zijlstra <peterz@infradead.org> | 2019-03-14 13:03:00 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-04-03 09:25:32 +0200 |
commit | 2c9651c38d1789d179c8d50724d037152ba85e56 (patch) | |
tree | fdcf95566dc57b81cd930ac4454455d86d2819bd /arch/x86/events | |
parent | c090cb70c6152fc97ce91242789d7c322109f1a1 (diff) | |
download | linux-2c9651c38d1789d179c8d50724d037152ba85e56.tar.bz2 |
perf/x86: Clear ->event_constraint[] on put
The current code unconditionally clears cpuc->event_constraint[i]
before calling get_event_constraints(.idx=i). The only site that cares
is intel_get_event_constraints() where the c1 load will always be
NULL.
However, always calling get_event_constraints() on all events is
wastefull, most times it will return the exact same result. Therefore
retain the logic in intel_get_event_constraints() and change the
generic code to only clear the constraint on put.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Stephane Eranian <eranian@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/events')
-rw-r--r-- | arch/x86/events/core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 9cab5adfa87a..279530111d8e 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -858,7 +858,6 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign) x86_pmu.start_scheduling(cpuc); for (i = 0, wmin = X86_PMC_IDX_MAX, wmax = 0; i < n; i++) { - cpuc->event_constraint[i] = NULL; c = x86_pmu.get_event_constraints(cpuc, i, cpuc->event_list[i]); cpuc->event_constraint[i] = c; @@ -948,6 +947,8 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign) */ if (x86_pmu.put_event_constraints) x86_pmu.put_event_constraints(cpuc, e); + + cpuc->event_constraint[i] = NULL; } } @@ -1411,6 +1412,7 @@ static void x86_pmu_del(struct perf_event *event, int flags) cpuc->event_list[i-1] = cpuc->event_list[i]; cpuc->event_constraint[i-1] = cpuc->event_constraint[i]; } + cpuc->event_constraint[i-1] = NULL; --cpuc->n_events; perf_event_update_userpage(event); |