Subject: Re: [PATCH v1 06/22] powerpc/ftrace: Inline ftrace_modify_code()

From: Michael Ellerman <[email-masked]>
Date: Fri, 22 Apr 2022 19:12:44 +1000

"Naveen N. Rao" <[email-masked]> writes:
> Christophe Leroy wrote:
>> Inlining ftrace_modify_code(), it increases a bit the
>> size of ftrace code but brings 5% improvment on ftrace
>> activation.
>> 
>> Signed-off-by: Christophe Leroy <[email-masked]>
>> ---
>>  arch/powerpc/kernel/trace/ftrace.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c
>> index 41c45b9c7f39..98e82fa4980f 100644
>> --- a/arch/powerpc/kernel/trace/ftrace.c
>> +++ b/arch/powerpc/kernel/trace/ftrace.c
>> @@ -53,7 +53,7 @@ ftrace_call_replace(unsigned long ip, unsigned long addr, int link)
>>  	return op;
>>  }
>> 
>> -static int
>> +static inline int
>>  ftrace_modify_code(unsigned long ip, ppc_inst_t old, ppc_inst_t new)
>>  {
>>  	ppc_inst_t replaced;
>
> I thought gcc was free to inline functions without the need for 
> 'inline'.

Yes it is.

> On the flip side, don't we need __always_inline if we want to force 
> inlining?

Yes. Since ac7c3e4ff401 ("compiler: enable CONFIG_OPTIMIZE_INLINING forcibly").

cheers