Re: [PATCH net-next v7] net/core: Introduce netdev_core_stats_inc()

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

 




On 2023/10/9 22:28, Steven Rostedt wrote:
On Mon, 9 Oct 2023 18:58:27 +0800
Yajun Deng <yajun.deng@xxxxxxxxx> 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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux