Re: [PATCH v2] perf mem: improves DSO long names search speed with RB tree
From: Waiman Long
Date: Wed Sep 17 2014 - 13:55:18 EST
On 09/17/2014 10:51 AM, Arnaldo Carvalho de Melo wrote:
Em Tue, Sep 16, 2014 at 03:08:19PM -0400, Waiman Long escreveu:
+++ b/tools/perf/util/dso.c
@@ -611,17 +611,93 @@ struct dso *dso__kernel_findnew(struct machine *machine, const char *name,
return dso;
}
+/*
+ * RB root of DSOs sorted by the long name
+ */
+static struct rb_root dso__longname_root = { NULL };
Use RB_ROOT, like in:
[acme@zoo linux]$ grep -w rb_root mm/vmalloc.c
static struct rb_root vmap_area_root = RB_ROOT;
[acme@zoo linux]$
I don't use RB_ROOT here because it gave compilation error.
But then can't this be made non-static, i.e. at the 'struct machine'
level? I.e. it is more likely that DSOs with the same long name are
really the same thing on a single 'struct machine', not accross multiple
ones or even multiple sessions (i.e. across multiple 'struct machines').
IIRC Adrian also pointed this out.
- Arnaldo
Yes, I am going to put the rb_root in the machine structure level as
suggested by Adrian. So the static rb_root will be gone. I also found
out that the dso__load_sym() function in util/symbol-elf.c may create
DSOs of the same long name which can be either "[kernel.allsyms]" or
"/lib/modules/.../vmlinux".
Cheers,
Longman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/