[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231009102833.1b0d35e3@gandalf.local.home>
Date: Mon, 9 Oct 2023 10:28:33 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Yajun Deng <yajun.deng@...ux.dev>
Cc: Eric Dumazet <edumazet@...gle.com>, mhiramat@...nel.org,
dennis@...nel.org, tj@...nel.org, cl@...ux.com, mark.rutland@....com,
davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org, Alexander Lobakin
<aleksander.lobakin@...el.com>, linux-trace-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH net-next v7] net/core: Introduce netdev_core_stats_inc()
On Mon, 9 Oct 2023 18:58:27 +0800
Yajun Deng <yajun.deng@...ux.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).
>
>
> Got it. Thank you.
Great.
-- Steve
Powered by blists - more mailing lists