• Peter Zijlstra's avatar
    perf/core: Optimize perf_init_event() · 66d258c5
    Peter Zijlstra authored
    Andi reported that he was hitting the linear search in
    perf_init_event() a lot. Make more agressive use of the IDR lookup to
    avoid hitting the linear search.
    
    With exception of PERF_TYPE_SOFTWARE (which relies on a hideous hack),
    we can put everything in the IDR. On top of that, we can alias
    TYPE_HARDWARE and TYPE_HW_CACHE to TYPE_RAW on the lookup side.
    
    This greatly reduces the chances of hitting the linear search.
    Reported-by: default avatarAndi Kleen <andi@firstfloor.org>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Kan <kan.liang@linux.intel.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    66d258c5
core.c 294 KB