Re: [PATCH v4 2/2] perf tool: improves DSO long names lookup speed with rbtree

From: Namhyung Kim
Date: Mon Sep 29 2014 - 00:02:52 EST


On Fri, 26 Sep 2014 11:22:34 -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Sep 24, 2014 at 11:45:40AM -0400, Waiman Long escreveu:
>> + /*
>> + * Find node with the matching name
>> + */
>> + while (*p) {
>> + struct dso *this = rb_entry(*p, struct dso, rb_node);
>> + long rc = (long)strcmp(name, this->long_name);
>> +
>> + parent = *p;
>> + if (rc == 0) {
>> + /*
>> + * In case the new DSO is a duplicate of an existing
>> + * one, print an one-time warning & sort the entry
>> + * by its DSO address.
>> + */
>> + if (!dso || (dso == this))
>> + return this; /* Find matching dso */
>> + /*
>> + * The kernel DSOs may have duplicated long name,
>> + * so don't print warning for them.
>> + */
>> + if (!warned && !strstr(name, "kernel.kallsyms")
>> + && !strstr(name, "/vmlinux")) {
>> + pr_warning("Duplicated dso long name: %s\n",
>> + name);
>
> Huh? Can you elaborate on this? Ho can we add multiple DSOs with the
> exact same name into this tree? Have you actually seen this in practice?
> I guess so, judging by the comment above ("may have").

I guess it's because we split maps and dsos by section name (for kernel
only). Please look at dso__load_sym() - If map_groups__find_by_name()
with short name + section name fails, it creates a new dso and map, and
then curr_dso->long_name will be set as dso->long_name.

Thanks,
Namhyung


>
> I'll try the patch to see if I get these warnings...
>
> But initial reaction to these long casts and fallbacking to pointer
> arithmetic for tree searching/inserting looked ugly :-\
--
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/