lkml.org 
[lkml]   [2010]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/2] perf:tools: avoid to create much more maps for kernel symbols on ARM
Em Wed, Nov 24, 2010 at 07:35:02PM +0800, tom.leiming@gmail.com escreveu:
> From: Ming Lei <tom.leiming@gmail.com>

> On ARM, module addresss space is ahead of kernel space, so the module
> symbols are handled before kernel symbol in dso__split_kallsyms, then
> cause one map is created for each kernel symbol.

> This patch fixes the issue by restoring to original kernel map in
> dso__split_kallsyms() to avoid create unnecessary maps for kernel
> symbols when starting to handle kenel symbol maps but after module
> symbol maps are handled over.

Can you try with the following patch instead?

- Arnaldo

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b39f499..a7518d2 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -530,7 +530,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
struct machine *machine = kmaps->machine;
struct map *curr_map = map;
struct symbol *pos;
- int count = 0;
+ int count = 0, moved = 0;
struct rb_root *root = &self->symbols[map->type];
struct rb_node *next = rb_first(root);
int kernel_range = 0;
@@ -588,6 +588,11 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
char dso_name[PATH_MAX];
struct dso *dso;

+ if (count == 0) {
+ curr_map = map;
+ goto filter_symbol;
+ }
+
if (self->kernel == DSO_TYPE_GUEST_KERNEL)
snprintf(dso_name, sizeof(dso_name),
"[guest.kernel].%d",
@@ -613,7 +618,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
map_groups__insert(kmaps, curr_map);
++kernel_range;
}
-
+filter_symbol:
if (filter && filter(curr_map, pos)) {
discard_symbol: rb_erase(&pos->rb_node, root);
symbol__delete(pos);
@@ -621,8 +626,9 @@ discard_symbol: rb_erase(&pos->rb_node, root);
if (curr_map != map) {
rb_erase(&pos->rb_node, root);
symbols__insert(&curr_map->dso->symbols[curr_map->type], pos);
- }
- count++;
+ ++moved;
+ } else
+ ++count;
}
}

@@ -632,7 +638,7 @@ discard_symbol: rb_erase(&pos->rb_node, root);
dso__set_loaded(curr_map->dso, curr_map->type);
}

- return count;
+ return count + moved;
}

int dso__load_kallsyms(struct dso *self, const char *filename,

\
 
 \ /
  Last update: 2010-11-24 15:47    [W:0.133 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site