From: Joe Perches <joe@perches.com>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel.h: Add a never optimized away pr_dbg for printk(KERN_DEBUG pr_fmt(fmt)...)
Date: Tue, 13 Oct 2009 21:21:49 -0700 [thread overview]
Message-ID: <1255494109.1851.7.camel@Joe-Laptop.home> (raw)
In-Reply-To: <alpine.DEB.1.00.0910132031040.1244@chino.kir.corp.google.com>
On Tue, 2009-10-13 at 20:34 -0700, David Rientjes wrote:
> On Tue, 13 Oct 2009, Joe Perches wrote:
> > Many developers use a logging message that
> > is printed at KERN_DEBUG level that is always
> > printed regardless of #define DEBUG levels.
> > pr_debug can be optimized away to a null statement.
> > Add a pr_dbg message that prints at KERN_DEBUG
> > level that uses pr_fmt() that can not be optimized
> > to nothing.
> pr_dbg() is horribly misnamed, it doesn't indicate why it exists vs.
> pr_debug() at all.
Partially true, it's reasonably named because it's very short.
> Future users will undoubtedly use it by mistake when
> they only really mean for the message to be emitted on DEBUG because
> they've seen it in other places and haven't checked the implementation.
The cost of using pr_dbg instead of pr_debug isn't high.
The primary benefit is getting an automatic pr_fmt
and shorter code.
> I'd suggest pr_debug_force(), even though it's much longer (although still
> shorter than printk(KERN_DEBUG)).
pr_dbg allows longer format strings without exceeding 80 chars.
printk(KERN_DEBUG
pr_debug_force
pr_dbg_always
pr_dbg_noopt
Other suggestions?
next prev parent reply other threads:[~2009-10-14 4:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-14 2:56 Joe Perches
2009-10-14 3:34 ` David Rientjes
2009-10-14 4:21 ` Joe Perches [this message]
2009-10-14 4:28 ` David Rientjes
2009-10-14 4:44 ` Joe Perches
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=1255494109.1851.7.camel@Joe-Laptop.home \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rientjes@google.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
all inboxes | Powered by JetHome®