public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Joe Perches <joe@perches.com>,
	Naohiro Ooiwa <nooiwa@miraclelinux.com>,
	Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>,
	roland@redhat.com, Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	oleg@redhat.com
Subject: Re: [PATCH] kernel.h: Add printk_ratelimited and pr_<level>_rl
Date: Tue, 10 Nov 2009 08:39:09 +0100	[thread overview]
Message-ID: <20091110073909.GA8874@elte.hu> (raw)
In-Reply-To: <1257838493.21088.6.camel@twins>


* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> On Tue, 2009-11-10 at 06:17 +0100, Ingo Molnar wrote:
> > * Andrew Morton <akpm@linux-foundation.org> wrote:
> > 
> > > On Fri, 30 Oct 2009 16:21:47 -0700
> > > Joe Perches <joe@perches.com> wrote:
> > > 
> > > > +#define pr_emerg_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
> > > > +#define pr_alert_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
> > > > +#define pr_crit_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
> > > > +#define pr_err_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
> > > > +#define pr_warning_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
> > > > +#define pr_notice_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
> > > > +#define pr_info_rl(fmt, ...) \
> > > > +        printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
> > > 
> > > Would prefer pr_emerg_ratelimited personally.  It's longer, but one 
> > > doesn't ask "wtf does _rl" mean and it avoids having two identifiers 
> > > which refer to the same thing.
> > 
> > Yeah. It will be rarely used so that it wont ever really be 'obvious at 
> > a glance', even to folks well versed in kernel source code details.
> 
> Is there a reason for all this pr_ nonsense? will we depricate printk()?

Yes, pr_*() has established itself as a printk shortcut. The benefits 
of:

  pr_info("stuff\n");

versus:

  printk(KERN_INFO "stuff\n");

are sufficiently large:

 - it's shorter by 9 characters (more than a level of indentation)

 - you cannot forget to add a KERN_ prefix - which is required for 98% 
   of all printks but which is forgotten from 50% of the submitted 
   patches.

so pr_*(), while named in a sucky way (all 2 letter abbrevs are sucky), 
has advantages, makes stuff more readable and reduces churn.

printk wont go away as an ad-hoc print-this tool. (Nor will we convert 
most of the remaining 18,000+ uses of printk() in the kernel, so 
printk() will be with us forever i guess.)

	Ingo

  reply	other threads:[~2009-11-10  7:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-30 11:36 [PATCH] show message when exceeded rlimit of pending signals Naohiro Ooiwa
2009-10-30 21:33 ` Andrew Morton
2009-10-30 21:45   ` Joe Perches
2009-10-30 23:21     ` [PATCH] kernel.h: Add printk_ratelimited and pr_<level>_rl Joe Perches
2009-11-02 15:58       ` Ingo Molnar
2009-11-05 14:16         ` Naohiro Ooiwa
2009-11-05 14:44           ` Naohiro Ooiwa
2009-11-09 21:49       ` Andrew Morton
2009-11-09 22:05         ` Joe Perches
2009-11-09 22:28           ` Randy Dunlap
2009-11-10  5:18           ` Ingo Molnar
2009-11-10  5:17         ` Ingo Molnar
2009-11-10  7:34           ` Peter Zijlstra
2009-11-10  7:39             ` Ingo Molnar [this message]
2009-11-10  7:54               ` Joe Perches
2009-11-10  8:21               ` Peter Zijlstra
2009-10-31  7:58   ` [PATCH] show message when exceeded rlimit of pending signals Naohiro Ooiwa
2009-10-31  8:50     ` Naohiro Ooiwa
2009-10-31  8:57       ` Andrew Morton
2009-10-31 11:05         ` Naohiro Ooiwa

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=20091110073909.GA8874@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=h-shimamoto@ct.jp.nec.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nooiwa@miraclelinux.com \
    --cc=oleg@redhat.com \
    --cc=roland@redhat.com \
    --cc=tglx@linutronix.de \
    /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