From: Frederic Weisbecker <fweisbec@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH][RFC] vsprintf: unify the format decoding layer for its 3 users
Date: Fri, 27 Feb 2009 08:12:13 +0100 [thread overview]
Message-ID: <20090227071212.GC5318@nowhere> (raw)
In-Reply-To: <20090226224656.5785de9e.akpm@linux-foundation.org>
On Thu, Feb 26, 2009 at 10:46:56PM -0800, Andrew Morton wrote:
> On Fri, 27 Feb 2009 07:19:37 +0100 Frederic Weisbecker <fweisbec@gmail.com> wrote:
>
> >
> > An new optimization is making its way to ftrace. Its purpose is to
> > make ftrace_printk() consuming less memory and be faster.
> >
> > Written by Lai Jiangshan, the approach is to delay the formatting
> > job from tracing time to output time.
> > Currently, a call to ftrace_printk will format the whole string and
> > insert it into the ring buffer.
>
> It does that? eek.
>
> > Then you can read it on /debug/tracing/trace
> > file.
> >
> > The new implementation stores the address of the format string and
> > the binary parameters into the ring buffer, making the packet more compact
> > and faster to insert.
> > Later, when the user exports the traces, the format string is retrieved
> > with the binary parameters and the formatting job is eventually done.
> >
> > Here is the result of a small comparative benchmark while putting the following
> > ftrace_printk on the timer interrupt. ftrace_printk is the old implementation,
> > ftrace_bprintk is a the new one:
> >
> > ftrace_printk("This is the timer interrupt: %llu", jiffies_64);
> >
> > After some time running on low load (no X, no really active processes):
> >
> > ftrace_printk: duration average: 2044 ns, avg of bytes stored per entry: 39
> > ftrace_bprintk: duration average: 1426 ns, avg of bytes stored per entry: 16
> >
> > Higher load (started X and launched a cat running on an X console looping on
> > traces printing):
> >
> > ftrace_printk: duration average: 8812 ns
> > ftrace_bprintk: duration average: 2611 ns
> >
> > Which means the new implementation can be 70 % faster on higher load.
> > And it consumes lesser memory on the ring buffer.
> >
> > The curent implementation rewrites a lot of format decoding bits from
> > vsnprintf() function, making now 3 differents functions to maintain
> > in their duplicated parts of printf format decoding bits.
>
> <looks for ftrace_bprintk() in linux-next, fails>
It hasn't been applied for now, waiting for this cleanup.
Grr, I can't find an http link for the patchset...
> Why does the current ftrace_bprintk() need to hack around in (or
> duplicate) vprintk() internals? It's a bit grubby, but by placing an
> upper bound on the number of args, it could simply call vscnprintf()
> directly?
>
The problem is more in the way to save the parameters.
You have two functions:
_int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args)
This one creates a compact binary packet of all args described in the format.
The result is a binary set of random values on bin_buf.
_int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf)
This one lately parses the buffer filled by vbin_printf() and eventually format
this binary contiguous set of binary values according to the format in fmt (which is the
same that was passed to vbin_printf()
The result is formatted in buf.
vbin uses too much specific write-to-bin_buf operations to allow us to wrap
vsnprintf()
It's the same for bstr_printf, but in the read from buffer way.
next prev parent reply other threads:[~2009-02-27 7:12 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-24 5:17 [PATCH 1/3] add binary printf Frederic Weisbecker
2009-02-26 13:02 ` Ingo Molnar
2009-02-26 17:05 ` Frederic Weisbecker
2009-02-26 17:43 ` Ingo Molnar
2009-02-26 17:45 ` Frederic Weisbecker
2009-02-26 17:52 ` Ingo Molnar
2009-02-26 18:34 ` Frederic Weisbecker
2009-02-26 18:45 ` Ingo Molnar
2009-02-26 18:52 ` Frederic Weisbecker
2009-02-26 18:56 ` Ingo Molnar
2009-02-26 19:05 ` Frederic Weisbecker
2009-02-27 6:19 ` [PATCH][RFC] vsprintf: unify the format decoding layer for its 3 users Frederic Weisbecker
2009-02-27 6:46 ` Andrew Morton
2009-02-27 7:12 ` Frederic Weisbecker [this message]
2009-02-27 7:39 ` Andrew Morton
2009-02-27 8:32 ` Ingo Molnar
2009-02-27 8:45 ` Andrew Morton
2009-02-27 9:35 ` Ingo Molnar
2009-02-27 8:20 ` Ingo Molnar
2009-02-27 8:33 ` Andrew Morton
2009-02-27 15:03 ` Steven Rostedt
2009-02-28 0:30 ` Linus Torvalds
2009-02-28 0:39 ` Linus Torvalds
2009-02-28 8:11 ` Frederic Weisbecker
2009-02-28 9:13 ` Ingo Molnar
2009-02-28 19:45 ` [PATCH 1/5] add binary printf Frederic Weisbecker
2009-02-28 20:16 ` [PATCH 2/5] ftrace: infrastructure for supporting binary record Frederic Weisbecker
2009-03-02 16:27 ` Steven Rostedt
2009-03-02 17:39 ` Frédéric Weisbecker
2009-02-28 21:30 ` [PATCH 3/5] ftrace: add ftrace_bprintk() Frederic Weisbecker
2009-03-02 16:34 ` Steven Rostedt
2009-03-02 17:45 ` Frédéric Weisbecker
2009-03-02 17:53 ` Steven Rostedt
2009-03-02 18:06 ` Frédéric Weisbecker
2009-03-02 18:23 ` Steven Rostedt
2009-03-02 18:55 ` Frédéric Weisbecker
2009-02-28 22:16 ` [PATCH 4/5] tracing/core: drop the old ftrace_printk implementation in favour of ftrace_bprintk Frederic Weisbecker
2009-03-02 16:37 ` Steven Rostedt
2009-03-02 17:47 ` Frédéric Weisbecker
2009-02-28 23:11 ` [PATCH][RFC] vsprintf: unify the format decoding layer for its 3 users Frederic Weisbecker
2009-03-01 2:34 ` [PATCH 5/5 v3] " Frederic Weisbecker
2009-03-01 3:31 ` [PATCH 0/5] Binary ftrace_printk Frederic Weisbecker
2009-02-28 16:54 ` [PATCH][RFC] vsprintf: unify the format decoding layer for its 3 users Linus Torvalds
2009-02-28 17:18 ` Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090227071212.GC5318@nowhere \
--to=fweisbec@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.