[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTinkvA=cVb4+ctR6w6bTsevttwp3C016Z2XEMAOC@mail.gmail.com>
Date: Thu, 25 Nov 2010 19:04:48 +0800
From: Ming Lei <tom.leiming@...il.com>
To: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: linux-kernel@...r.kernel.org, Ian Munsie <imunsie@....ibm.com>,
Ingo Molnar <mingo@...e.hu>, Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Thomas Gleixner <tglx@...utronix.de>,
Tom Zanussi <tzanussi@...il.com>
Subject: Re: [PATCH 1/2] perf:tools: avoid to create much more maps for kernel
symbols on ARM
2010/11/24 Arnaldo Carvalho de Melo <acme@...stprotocols.net>:
> Em Wed, Nov 24, 2010 at 07:35:02PM +0800, tom.leiming@...il.com escreveu:
>> From: Ming Lei <tom.leiming@...il.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?
Fine to me.
Reported-and-tested-by: Ming Lei <tom.leiming@...il.com>
>
> - 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,
>
thanks,
--
Lei Ming
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists