From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@elte.hu>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing: use hash table to simulate the sparse array
Date: Thu, 02 Jul 2009 09:29:51 +0800 [thread overview]
Message-ID: <4A4C0D8F.20005@cn.fujitsu.com> (raw)
In-Reply-To: <20090701192514.GA5740@nowhere>
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.
next prev parent reply other threads:[~2009-07-02 1:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-22 7:09 [PATCH] tracing: rewrite trace_save_cmdline() Lai Jiangshan
2009-06-30 8:47 ` [PATCH] tracing: use hash table to simulate the sparse array Lai Jiangshan
2009-06-30 11:59 ` Frederic Weisbecker
2009-07-01 2:31 ` Lai Jiangshan
2009-07-01 19:25 ` Frederic Weisbecker
2009-07-02 1:29 ` Lai Jiangshan [this message]
2009-07-06 0:56 ` Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A4C0D8F.20005@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome