Commit 3445432b authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf symbols: avoid SyS kernel syscall aliases

When removing duplicate symbols, prefer to remove syscall aliases
starting with SyS or compat_SyS.

A side-effect of that is that it results in slightly improved results
for the "vmlinux symtab matches kallsyms" test.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1375875537-4509-6-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 2bbf03f1
...@@ -87,6 +87,7 @@ static int choose_best_symbol(struct symbol *syma, struct symbol *symb) ...@@ -87,6 +87,7 @@ static int choose_best_symbol(struct symbol *syma, struct symbol *symb)
{ {
s64 a; s64 a;
s64 b; s64 b;
size_t na, nb;
/* Prefer a symbol with non zero length */ /* Prefer a symbol with non zero length */
a = syma->end - syma->start; a = syma->end - syma->start;
...@@ -120,11 +121,21 @@ static int choose_best_symbol(struct symbol *syma, struct symbol *symb) ...@@ -120,11 +121,21 @@ static int choose_best_symbol(struct symbol *syma, struct symbol *symb)
else if (a > b) else if (a > b)
return SYMBOL_B; return SYMBOL_B;
/* If all else fails, choose the symbol with the longest name */ /* Choose the symbol with the longest name */
if (strlen(syma->name) >= strlen(symb->name)) na = strlen(syma->name);
nb = strlen(symb->name);
if (na > nb)
return SYMBOL_A; return SYMBOL_A;
else else if (na < nb)
return SYMBOL_B;
/* Avoid "SyS" kernel syscall aliases */
if (na >= 3 && !strncmp(syma->name, "SyS", 3))
return SYMBOL_B; return SYMBOL_B;
if (na >= 10 && !strncmp(syma->name, "compat_SyS", 10))
return SYMBOL_B;
return SYMBOL_A;
} }
void symbols__fixup_duplicate(struct rb_root *symbols) void symbols__fixup_duplicate(struct rb_root *symbols)
......
Markdown is supported
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