From: Andrew Morton <akpm@linux-foundation.org>
To: "Vegard Nossum" <vegard.nossum@gmail.com>
Cc: "Nick Piggin" <nickpiggin@yahoo.com.au>,
"Hugh Dickins" <hugh@veritas.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: Fix printk format strings
Date: Thu, 11 Oct 2007 00:13:00 -0700 [thread overview]
Message-ID: <20071011001300.7682a93b.akpm@linux-foundation.org> (raw)
In-Reply-To: <19f34abd0710110004k78d103fate87558822fb631a3@mail.gmail.com>
On Thu, 11 Oct 2007 09:04:57 +0200 "Vegard Nossum" <vegard.nossum@gmail.com> wrote:
> > > - printk("Active:%lu inactive:%lu dirty:%lu writeback:%lu unstable:%lu\n"
> > > - " free:%lu slab:%lu mapped:%lu pagetables:%lu bounce:%lu\n",
> > > + printk("Active:%lu inactive:%lu dirty:%lu writeback:%lu unstable:%lu\n",
> > > global_page_state(NR_ACTIVE),
> > > global_page_state(NR_INACTIVE),
> > > global_page_state(NR_FILE_DIRTY),
> > > global_page_state(NR_WRITEBACK),
> > > - global_page_state(NR_UNSTABLE_NFS),
> > > + global_page_state(NR_UNSTABLE_NFS));
> > > + printk(" free:%lu slab:%lu mapped:%lu pagetables:%lu bounce:%lu\n",
> > > global_page_state(NR_FREE_PAGES),
> > > global_page_state(NR_SLAB_RECLAIMABLE) +
> > > global_page_state(NR_SLAB_UNRECLAIMABLE),
> >
> > I don't understand the reason for this change.
>
> I'm sorry :). It helps to make one line per call only, since this
> allows changing the printk internals for the better by reducing some
> complexity. I believe this is a good thing. I have a patch that
> changes printk, but it assumes that each format string only contains a
> single line. Is this a very bad assumption to make? Or maybe I should
> have sent that change first and made a reference to it?
>
> But don't you also agree, on the grounds of principle, that a single
> line per call is better style?
Well we do multiple-lines-per-printk in rather a lot of places and it has
two advantages:
- less text size (I expect)
- the printk is "atomic" in that the logically-connected output lines
won't get tangled up with an intervening printk from another CPU, or from
an interrupt handler on this CPU.
Those are pretty modest advantages and I guess we could live without them
if we got a significant gain from doing so. But it'd take quite some
effort hunting down all the callsites, and preventing new ones from
occuring.
next prev parent reply other threads:[~2007-10-11 7:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-11 6:47 [PATCH] mm: Fix printk format strings Vegard Nossum
2007-10-11 6:53 ` Andrew Morton
2007-10-11 7:04 ` Vegard Nossum
2007-10-11 7:13 ` Andrew Morton [this message]
2007-10-11 7:37 ` Vegard Nossum
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=20071011001300.7682a93b.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=vegard.nossum@gmail.com \
/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