lkml.org 
[lkml]   [2023]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH net-next v7] net/core: Introduce netdev_core_stats_inc()
From

On 2023/10/9 22:28, Steven Rostedt wrote:
> On Mon, 9 Oct 2023 18:58:27 +0800
> Yajun Deng <yajun.deng@linux.dev> wrote:
>
>>> C compiler decides to inline or not, depending on various factors.
>>>
>>> The most efficient (and small) code is generated by this_cpu_inc()
>>> version, allowing the compiler to inline it.
>>>
>>> If you copy/paste this_cpu_inc() twenty times, then the compiler
>>> would not inline the function anymore.
> Yes, if you want something to be visible by ftrace, it must not be inlined
> (as inlined functions are not function calls by definition). And as Eric
> stated, the compiler is perfectly allowed to inline something if it
> believes it will be more efficient. i.e. There may be code around the function
> call that could be more efficient if it wasn't change to parameters. If you
> want to make sure a function stays out of line, you must explicitly tell
> the compiler you want the function not to ever be inlined (hence the
> "noinline" attribute).


Thanks for the details.

>>
>> Got it. Thank you.
> Great.
>
> -- Steve

\
 
 \ /
  Last update: 2023-10-10 05:47    [W:0.050 / U:1.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site