From: Matt Mackall <mpm@selenic.com>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Use vprintk rather that vsnprintf where possible
Date: Thu, 04 Dec 2008 22:08:20 -0600 [thread overview]
Message-ID: <1228450100.3255.180.camel@calx> (raw)
In-Reply-To: <ac3eb2510812041905j639ea7d4ybe8e83b0d7c5965e@mail.gmail.com>
On Fri, 2008-12-05 at 04:05 +0100, Kay Sievers wrote:
> On Thu, Dec 4, 2008 at 21:41, Matt Mackall <mpm@selenic.com> wrote:
> > This does away with lots of large static and on-stack buffers as well
> > as a few associated locks.
>
> > - len = snprintf(s, 256, KERN_DEBUG "%s: ", prefix);
> > -
> > va_start(args, fmt);
> > - len += vsnprintf(&s[len], (256 - len), fmt, args);
> > + printk(KERN_DEBUG "%s: ", prefix);
> > + vprintk(fmt, args);
>
> If we convert to two printk calls for a single line, does that not
> possibly get mixed up with printks from other locations and lead to
> hardly readable log output?
Once upon a time it was not uncommon to get printks interleaved on a
character by character basis when things went wrong. That was a bit of a
problem but still decipherable with some effort. This shouldn't be much
of a problem at all and indeed there are numerous other places where
printing is done in multiple pieces.
If we want to deal with the interleaving problem, we should do it by
making printk itself smarter rather than having users do bloaty, gross
things. Look at the code that's getting replaced here. Some of these
things use stack space which has much worse potential failure modes.
Others use locking on a static buffer - if that ever hits, we probably
lose a message. And the remainder use a static buffer with no locking:
potential garbage output. And of course, the static buffer is wasting
space when not in use, which is almost all the time.
--
Mathematics is the supreme nostalgia of our time.
next prev parent reply other threads:[~2008-12-05 4:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-04 20:41 [PATCH] Use vprintk rather that vsnprintf where possible Matt Mackall
2008-12-05 3:05 ` Kay Sievers
2008-12-05 3:13 ` Nick Andrew
2008-12-05 4:08 ` Matt Mackall [this message]
2008-12-05 4:21 ` Joe Perches
2008-12-05 13:49 ` Tilman Schmidt
2008-12-07 8:05 ` Andrew Morton
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=1228450100.3255.180.camel@calx \
--to=mpm@selenic.com \
--cc=akpm@linux-foundation.org \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox