linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Overhead of ring buffer in Ftrace
@ 2019-08-02  5:41 Fang Zhou
  2019-08-06 16:00 ` Fang Zhou
  0 siblings, 1 reply; 2+ messages in thread
From: Fang Zhou @ 2019-08-02  5:41 UTC (permalink / raw)
  To: linux-kernel

Hi all,

I’m currently using Ftrace with tracepoints to trace several events in
kernel. But I found the tracing overhead is a little high.

I found the major overhead comes from
“local_dec(&cpu_buffer->committing);” in rb_end_commit() function.
local_dec() will invoke atomic_long_dec(), which finally performs
LOCK_PREFIX plus "DECQ" on this variable.

I'm a little confused. cpu_buffer is a per-cpu buffer. Therefore, I
cannot come up with a scenario that two core runs INC or DEC on the
same per-cpu value at the same time.
So, why do we use such heavy-overhead operation here? Can we just
simply use "DECQ" without LOCK_PREFIX?

Thanks,
Tim

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Overhead of ring buffer in Ftrace
  2019-08-02  5:41 Overhead of ring buffer in Ftrace Fang Zhou
@ 2019-08-06 16:00 ` Fang Zhou
  0 siblings, 0 replies; 2+ messages in thread
From: Fang Zhou @ 2019-08-06 16:00 UTC (permalink / raw)
  To: linux-kernel

Any ideas or suggestions?

Best,
Tim

On Fri, Aug 2, 2019 at 1:41 AM Fang Zhou <timchou.hit@gmail.com> wrote:
>
> Hi all,
>
> I’m currently using Ftrace with tracepoints to trace several events in
> kernel. But I found the tracing overhead is a little high.
>
> I found the major overhead comes from
> “local_dec(&cpu_buffer->committing);” in rb_end_commit() function.
> local_dec() will invoke atomic_long_dec(), which finally performs
> LOCK_PREFIX plus "DECQ" on this variable.
>
> I'm a little confused. cpu_buffer is a per-cpu buffer. Therefore, I
> cannot come up with a scenario that two core runs INC or DEC on the
> same per-cpu value at the same time.
> So, why do we use such heavy-overhead operation here? Can we just
> simply use "DECQ" without LOCK_PREFIX?
>
> Thanks,
> Tim

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-06 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02  5:41 Overhead of ring buffer in Ftrace Fang Zhou
2019-08-06 16:00 ` Fang Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).