[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220512101229.7886a798@gandalf.local.home>
Date: Thu, 12 May 2022 10:12:29 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Li kunyu <kunyu@...china.com>
Cc: mingo@...hat.com, linux@...linux.org.uk, paul.walmsley@...ive.com,
palmer@...belt.com, aou@...s.berkeley.edu, hca@...ux.ibm.com,
gor@...ux.ibm.com, agordeev@...ux.ibm.com,
borntraeger@...ux.ibm.com, svens@...ux.ibm.com, tglx@...utronix.de,
bp@...en8.de, dave.hansen@...ux.intel.com, x86@...nel.org,
hpa@...or.com, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
linux-s390@...r.kernel.org
Subject: Re: [PATCH] kernel: Ftrace seems to have functions to improve
performance through optimization
On Thu, 12 May 2022 14:30:17 +0800
Li kunyu <kunyu@...china.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@...china.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,
Powered by blists - more mailing lists