lkml.org 
[lkml]   [2022]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kernel: Ftrace seems to have functions to improve performance through optimization
On Thu, 12 May 2022 14:30:17 +0800
Li kunyu <kunyu@nfschina.com> wrote:

> At present, it is found that two functions could be optimized, and the
> performance may be improved.

"may be impoved"?

Have any numbers? This changes a very slow path. I do not think it is worth
it for the "optimized". Also it's a weak function. An arch may be added that
wants to return a value.

>
> Signed-off-by: Li kunyu <kunyu@nfschina.com>
> ---


> void ftrace_modify_all_code(int command)
> @@ -2804,12 +2802,7 @@ void __weak arch_ftrace_update_code(int command)
>
> static void ftrace_run_update_code(int command)
> {
> - int ret;
> -
> - ret = ftrace_arch_code_modify_prepare();
> - FTRACE_WARN_ON(ret);

Currently no arch returns anything but zero, but this was added in case
something wrong did happen, and the FTRACE_WARN_ON() is more than just a
WARN_ON(). It will also disable ftrace.

Now, I'm not totally against this change, but not for the rationale in the
change log. That is, there is no optimization here. But as a standard clean
up with something like "There is currently no version of
ftrace_arch_code_modify_prepare() that returns anything bug zero, so the
check is not needed" is a more appropriate reason for this change.

-- Steve


> - if (ret)
> - return;
> + ftrace_arch_code_modify_prepare();
>
> /*
> * By default we use stop_machine() to modify the code.
> @@ -2819,8 +2812,7 @@ static void ftrace_run_update_code(int command)
> */
> arch_ftrace_update_code(command);
>
> - ret = ftrace_arch_code_modify_post_process();
> - FTRACE_WARN_ON(ret);
> + ftrace_arch_code_modify_post_process();
> }
>
> static void ftrace_run_modify_code(struct ftrace_ops *ops, int command,

\
 
 \ /
  Last update: 2022-05-12 16:14    [W:0.074 / U:0.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site