[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9d06b27a-c2ce-41b8-9657-151000c0b244@linaro.org>
Date: Mon, 17 Mar 2025 15:26:42 +0000
From: James Clark <james.clark@...aro.org>
To: Leo Yan <leo.yan@....com>
Cc: lcherian@...vell.com, coresight@...ts.linaro.org,
Mike Leach <mike.leach@...aro.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com
Subject: Re: [PATCH 6/7] coresight: Remove inlines from static function
definitions
On 14/03/2025 9:50 am, Leo Yan wrote:
> On Tue, Feb 11, 2025 at 10:39:42AM +0000, James Clark wrote:
>>
>> These are all static and in one compilation unit so the inline has no
>> effect on the binary.
>
> I read the doc coding-style.rst, the section "15) The inline disease",
> my understanding is though the inline is not encouraged, I prefer we can
> follow up the rule:
>
> A reasonable rule of thumb is to not put inline at functions that have more
> than 3 lines of code in them. An exception to this rule are the cases where
> a parameter is known to be a compile time constant, and as a result of this
> constantness you *know* the compiler will be able to optimize most of your
> function away at compile time. For a good example of this later case, see
> the kmalloc() inline function.
>
Isn't this advice about whether to make an inline function in a header
file or do definition + declaration? I only removed static ones local to
.c files where 'inline' has no effect at all. We build with optimisation
enabled so the compiler already auto inlines small functions and ignores
the inline keyword for large re-used ones anyway.
>> Except if FTRACE is enabled, then some functions
>> which were already not inlined now get the nops added which allows them
>> to be traced.
>
> I understand it is a side effect that we cannot use function tracer for
> inline functions. This is not a big issue for me, as we still can use
> "perf probe" and trace_printk() for debugging.
>
> Thanks,
> Leo
>
I think it can be useful, I've used it a little bit. Might as well make
it easier to use for someone if it exists.
Powered by blists - more mailing lists