Re: [PATCH] kernel: Ftrace seems to have functions to improve performance through optimization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 12 May 2022 14:30:17 +0800
Li kunyu <kunyu@xxxxxxxxxxxx> 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@xxxxxxxxxxxx>
> ---


>  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,




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux