[PATCH] kernel: Ftrace seems to have functions to improve performance through optimization
Steven Rostedt
rostedt at goodmis.org
Thu May 12 07:12:29 PDT 2022
On Thu, 12 May 2022 14:30:17 +0800
Li kunyu <kunyu at 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 at 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,
More information about the linux-riscv
mailing list