[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y34f+IqqSGbtC82V@alley>
Date: Wed, 23 Nov 2022 14:28:24 +0100
From: Petr Mladek <pmladek@...e.com>
To: Zhen Lei <thunder.leizhen@...wei.com>
Cc: Josh Poimboeuf <jpoimboe@...nel.org>,
Jiri Kosina <jikos@...nel.org>,
Miroslav Benes <mbenes@...e.cz>,
Joe Lawrence <joe.lawrence@...hat.com>,
live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
Masahiro Yamada <masahiroy@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Jiri Olsa <jolsa@...nel.org>,
Kees Cook <keescook@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Luis Chamberlain <mcgrof@...nel.org>,
linux-modules@...r.kernel.org,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>,
David Laight <David.Laight@...lab.com>
Subject: Re: [PATCH v8 6/9] livepatch: Use kallsyms_on_each_match_symbol() to
improve performance
Hi,
I am sorry for the late review. I have been snowed under another
tasks.
On Wed 2022-11-02 16:49:18, Zhen Lei wrote:
> Based on the test results of kallsyms_on_each_match_symbol() and
> kallsyms_on_each_symbol(), the average performance can be improved by
> more than 1500 times.
Sounds great.
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
> @@ -153,6 +153,24 @@ static int klp_find_callback(void *data, const char *name,
> return 0;
> }
>
> +static int klp_match_callback(void *data, unsigned long addr)
> +{
> + struct klp_find_arg *args = data;
> +
> + args->addr = addr;
> + args->count++;
> +
> + /*
> + * Finish the search when the symbol is found for the desired position
> + * or the position is not defined for a non-unique symbol.
> + */
> + if ((args->pos && (args->count == args->pos)) ||
> + (!args->pos && (args->count > 1)))
> + return 1;
> +
> + return 0;
This duplicates most of the klp_find_callback(). Please, call this
new function in klp_find_callback() instead of the duplicated code.
I mean to do:
static int klp_find_callback(void *data, const char *name, unsigned long addr)
{
struct klp_find_arg *args = data;
if (strcmp(args->name, name))
return 0;
return klp_match_callback(data, addr);
}
Otherwise, it looks good.
Best Regards,
Petr
Powered by blists - more mailing lists