[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A4C0D8F.20005@cn.fujitsu.com>
Date: Thu, 02 Jul 2009 09:29:51 +0800
From: Lai Jiangshan <laijs@...fujitsu.com>
To: Frederic Weisbecker <fweisbec@...il.com>
CC: Steven Rostedt <rostedt@...dmis.org>, Ingo Molnar <mingo@...e.hu>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing: use hash table to simulate the sparse array
Frederic Weisbecker wrote:
>
> Hmm, I'm confused.
> When you map a new pid, you do the following:
>
> +static void do_map_cmdline_index(unsigned int idx, unsigned int pid)
> +{
> + unsigned int hash = hash_32(pid, SAVED_CMDLINES_SHIFT);
> +
> + if (map_cmdline_to_pid(idx) != NO_CMDLINE_MAP)
> + hlist_del(&indexes[idx].node);
> + indexes[idx].pid = pid;
> + hlist_add_head(&indexes[idx].node, &map_head[hash]);
> +}
>
> Then if there was a pid that had the same hash, it is deleted
> from the hashlist and the new one steal his place, which
> lead me to think you won't have more than one entry per hash.
>
>
indexes[idx] is deleted, not "indexes[hash]".
idx is chosen by the FIFO algorithm(which I did not change).
It is the earliest mapped item, its place is replaced by new item.
So map_head[hash] may have 2 or more entries(with different idx).
The whole patch do one thing only:
implement map_pid_to_cmdline(pid), and make it equals to
original map_pid_to_cmdline[pid] always.
--
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