perf/x86: Clear ->event_constraint[] on put
authorPeter Zijlstra <peterz@infradead.org>
Thu, 14 Mar 2019 12:03:00 +0000 (13:03 +0100)
committerIngo Molnar <mingo@kernel.org>
Wed, 3 Apr 2019 07:25:32 +0000 (09:25 +0200)
commit2c9651c38d1789d179c8d50724d037152ba85e56
treefdcf95566dc57b81cd930ac4454455d86d2819bd
parentc090cb70c6152fc97ce91242789d7c322109f1a1
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>
arch/x86/events/core.c