From: Stanislaw Gruszka <stf_xl@wp.pl>
To: Petr Mladek <pmladek@suse.com>
Cc: linux-modules@vger.kernel.org,
Sami Tolvanen <samitolvanen@google.com>,
Luis Chamberlain <mcgrof@kernel.org>,
Petr Pavlu <petr.pavlu@suse.com>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
live-patching@vger.kernel.org, Daniel Gomez <da.gomez@kernel.org>,
Aaron Tomlin <atomlin@atomlin.com>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Jordan Rome <linux@jordanrome.com>,
Viktor Malik <vmalik@redhat.com>, Miroslav Benes <mbenes@suse.cz>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Joe Lawrence <joe.lawrence@redhat.com>
Subject: Re: [PATCH v2 2/2] module/kallsyms: sort function symbols and use binary search
Date: Tue, 17 Nov 2026 13:12:04 +0100 [thread overview]
Message-ID: <avxElFF4GY1Jhk02@wp.pl> (raw)
In-Reply-To: <afnhidn7K7dZ_cPh@pathway.suse.cz>
Hi
On Tue, May 05, 2026 at 02:24:41PM +0200, Petr Mladek wrote:
> 2. Livepatches _rely on the sorting_ of symbols in the module.
> The special relocation symbols might define a symbol position,
> see
>
> .klp.sym.objname.symbol_name,sympos
>
> in the documentation. It defines the position of the symbol
> when there are more symbols of the same name, see
> klp_match_callback() in kernel/livepatch/core.c.
>
> I am afraid that _this patch might break_ this when it moves
> function symbols before non-funciton ones. I guess that
> the symbols of the same name will not longer be groupped.
Thanks for pointing this out. It took me quite a while to understand
the issue, but I finally got it.
> Idea: Is the shufling really important for the performance, please?
One reason I wanted to shuffle the symbols was to also speed up
name-based lookups, assuming that most lookups are for function
symbols. Moving them to the beginning of the table reduces the
number of entries that need to be scanned in the common case.
In my benchmarks, this reduced the average time spent in
__find_kallsyms_symbol_value() from 16 us to 6 us.
> I would expect that binary search would have a good performance
> even without the shuffling. It puts aside half of the symbols in
> one cycle.
I'm now going with a separate sorted index table, leaving the original
symtab untouched.
I think the name lookup optimization could be revisited later by
introducing a new function that uses the index table to search only
text symbols, where appropriate.
Regards
Stanislaw
next prev parent reply other threads:[~2026-11-17 12:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 11:00 [PATCH v2 1/2] module/kallsyms: fix nextval for data symbol lookup Stanislaw Gruszka
2026-03-27 11:00 ` [PATCH v2 2/2] module/kallsyms: sort function symbols and use binary search Stanislaw Gruszka
2026-04-23 14:00 ` Petr Pavlu
2026-04-24 9:13 ` Stanislaw Gruszka
2026-04-27 13:51 ` Petr Pavlu
2026-04-28 8:23 ` Stanislaw Gruszka
2026-11-17 11:17 ` Stanislaw Gruszka
2026-05-05 12:24 ` Petr Mladek
2026-05-05 14:37 ` Petr Pavlu
2026-05-06 8:58 ` Petr Mladek
2026-05-06 9:42 ` Petr Pavlu
2026-11-17 12:12 ` Stanislaw Gruszka [this message]
2026-04-08 15:24 ` [PATCH v2 1/2] module/kallsyms: fix nextval for data symbol lookup Petr Pavlu
2026-07-10 12:36 ` Petr Pavlu
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=avxElFF4GY1Jhk02@wp.pl \
--to=stf_xl@wp.pl \
--cc=atomlin@atomlin.com \
--cc=da.gomez@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux@jordanrome.com \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=mcgrof@kernel.org \
--cc=mhiramat@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=samitolvanen@google.com \
--cc=vmalik@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
all inboxes | Powered by JetHome®