Skip to content
Commit 1e628569 authored by Eric Saint-Etienne's avatar Eric Saint-Etienne Committed by Arnaldo Carvalho de Melo
Browse files

perf symbols: Fix slowness due to -ffunction-section



Perf can take minutes to parse an image when -ffunction-section is used.
This is especially true with the kernel image when it is compiled this
way, which is the arm64 default since the patcheset "Enable deadcode
elimination at link time".

Perf organize maps using a rbtree. Whenever perf finds a new symbols, it
first searches this rbtree for the map it belongs to, by strcmp()'aring
section names.  When it finds the map with the right name, it uses it to
add the symbol. With a usual image there aren't so many maps but when
using -ffunction-section there's basically one map per function.  With
the kernel image that's north of 40,000 maps. For most symbols perf has
to parses the entire rbtree to eventually create a new map and add it.
Consequently perf spends most of the time browsing a rbtree that keeps
getting larger.

This performance fix introduces a secondary rbtree that indexes maps
based on the section name.

Signed-off-by: default avatarEric Saint-Etienne <eric.saint.etienne@oracle.com>
Reviewed-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
Reviewed-by: default avatarDavid Aldridge <david.aldridge@oracle.com>
Reviewed-by: default avatarRob Gardner <rob.gardner@oracle.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1542822679-25591-1-git-send-email-eric.saint.etienne@oracle.com
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent dd1d0044
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment