From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andi Kleen <andi@firstfloor.org>,
jbaron@redhat.com, rostedt@goodmis.com,
linux-kernel@vger.kernel.org, mingo@elte.hu, tglx@linutronix.de,
roland@redhat.com, rth@redhat.com, mhiramat@redhat.com,
fweisbec@gmail.com, avi@redhat.com, davem@davemloft.net,
vgoyal@redhat.com, sam@ravnborg.org, tony@bakeyournoodle.com,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 2/2] Rewrite jump_label.c to use binary search
Date: Wed, 22 Sep 2010 15:43:31 -0400 [thread overview]
Message-ID: <20100922194331.GB28463@Krystal> (raw)
In-Reply-To: <4C9A2AED.3050801@zytor.com>
* H. Peter Anvin (hpa@zytor.com) wrote:
> On 09/22/2010 03:08 AM, Andi Kleen wrote:
>>
>> I believe it's also much cleaner than before.
>>
>> I did some performance tests comparing the hash implementation
>> with the binary search. This was with a moderate config x86-64
>> kernel with 68 modules loaded and about 480 trace points active
>> in several modules and 1340 dynamic debug statements.
>>
>
> Now, the ideal data structure for this stuff is something called a
> minimal perfect hash. This is something that would have to be generated
> (for each module and for the monolithic kernel) at compile time --
> presumably in modpost -- because the static generation of them is fairly
> complex.
>
> That would provide extremely simple handling in the kernel (just do some
> shifts and a table lookup and you have your answer) and if combined with
> an AVL or red-black tree holding the module addresses it would give
> extremely fast address-to-metadata lookup, not just for this but also
> for things like exception handling.
>
> I have used MPH's in other projects and pitched them to Linus at one
> point for exception handling. What is clear, though, is that we should
> do the same thing for exceptions, trace points, and any other similar
> things that depend on exact PC.
That's a very interesting idea, which applies very well to exception
handlers, but tracepoints and static jumps suffer from the problem that
there are many possible instances of the same key.
Tracepoints use a lookup by tracepoint name. Static jumps use a lookup
by associated variable address (but this variable can be associated with
many instances, e.g. in the case of static inline functions, or just
when the same variable is used to control many instances of static
jumps).
But maybe we could find a way to do an initial sort phase, so the
perfect hash could point to the first entry corresponding to the looked
up key ?
Thanks,
Mathieu
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2010-09-22 19:43 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-22 10:08 [PATCH 1/2] Add for_each_module iterator function Andi Kleen
2010-09-22 10:08 ` [PATCH 2/2] Rewrite jump_label.c to use binary search Andi Kleen
2010-09-22 11:31 ` Mathieu Desnoyers
2010-09-22 11:56 ` Andi Kleen
2010-09-22 12:04 ` Andi Kleen
2010-09-22 15:02 ` Mathieu Desnoyers
2010-09-22 15:07 ` Mathieu Desnoyers
2010-09-22 15:43 ` Jason Baron
2010-09-22 15:28 ` Jason Baron
2010-09-22 19:19 ` Mathieu Desnoyers
2010-09-22 13:46 ` Jason Baron
2010-09-22 18:14 ` Jason Baron
2010-09-22 11:57 ` Frederic Weisbecker
2010-09-22 16:12 ` H. Peter Anvin
2010-09-22 19:43 ` Mathieu Desnoyers [this message]
2010-09-22 20:06 ` H. Peter Anvin
2010-09-22 20:41 ` Mathieu Desnoyers
2010-09-22 20:54 ` H. Peter Anvin
2010-09-22 12:25 ` [PATCH 1/2] Add for_each_module iterator function Thomas Gleixner
2010-09-22 12:52 ` Andi Kleen
2010-09-22 14:03 ` Mathieu Desnoyers
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=20100922194331.GB28463@Krystal \
--to=mathieu.desnoyers@polymtl.ca \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=avi@redhat.com \
--cc=davem@davemloft.net \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jbaron@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=roland@redhat.com \
--cc=rostedt@goodmis.com \
--cc=rth@redhat.com \
--cc=sam@ravnborg.org \
--cc=tglx@linutronix.de \
--cc=tony@bakeyournoodle.com \
--cc=vgoyal@redhat.com \
/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