From: Phil Carmody <ext-phil.2.carmody@nokia.com>
To: ext Greg KH <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
torvalds@linux-foundation.org, akpm@linux-foundation.org,
alan@lxorguk.ukuu.org.uk, Paolo Bonzini <pbonzini@redhat.com>,
Petr Matousek <pmatouse@redhat.com>,
linux-scsi@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
James Bottomley <JBottomley@parallels>
Subject: Re: [23/27] kernel.h: add printk_ratelimited and pr_<level>_rl
Date: Tue, 24 Jan 2012 16:46:13 +0200 [thread overview]
Message-ID: <20120124144613.GD3180@pcarmody2.research.nokia.com> (raw)
In-Reply-To: <20120123234203.649739932@clark.kroah.org>
On 23/01/12 15:41 -0800, ext Greg KH wrote:
> 2.6.32-longterm review patch. If anyone has any objections, please let me know.
This looks like an added feature with no users in .32 - does it really
belong in a stable tree?
(But to be explicit, I have no issue with its contents at all.)
Phil
> ------------------
>
>
> From: Joe Perches <joe@perches.com>
>
> commit 8a64f336bc1d4aa203b138d29d5a9c414a9fbb47 upstream.
>
> Add a printk_ratelimited statement expression macro that uses a per-call
> ratelimit_state so that multiple subsystems output messages are not
> suppressed by a global __ratelimit state.
>
> [akpm@linux-foundation.org: coding-style fixes]
> [akpm@linux-foundation.org: s/_rl/_ratelimited/g]
> Signed-off-by: Joe Perches <joe@perches.com>
> Cc: Naohiro Ooiwa <nooiwa@miraclelinux.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
>
> ---
> include/linux/kernel.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -407,6 +407,50 @@ static inline char *pack_hex_byte(char *
> #endif
>
> /*
> + * ratelimited messages with local ratelimit_state,
> + * no local ratelimit_state used in the !PRINTK case
> + */
> +#ifdef CONFIG_PRINTK
> +#define printk_ratelimited(fmt, ...) ({ \
> + static struct ratelimit_state _rs = { \
> + .interval = DEFAULT_RATELIMIT_INTERVAL, \
> + .burst = DEFAULT_RATELIMIT_BURST, \
> + }; \
> + \
> + if (!__ratelimit(&_rs)) \
> + printk(fmt, ##__VA_ARGS__); \
> +})
> +#else
> +/* No effect, but we still get type checking even in the !PRINTK case: */
> +#define printk_ratelimited printk
> +#endif
> +
> +#define pr_emerg_ratelimited(fmt, ...) \
> + printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
> +#define pr_alert_ratelimited(fmt, ...) \
> + printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
> +#define pr_crit_ratelimited(fmt, ...) \
> + printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
> +#define pr_err_ratelimited(fmt, ...) \
> + printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
> +#define pr_warning_ratelimited(fmt, ...) \
> + printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
> +#define pr_notice_ratelimited(fmt, ...) \
> + printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
> +#define pr_info_ratelimited(fmt, ...) \
> + printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
> +/* no pr_cont_ratelimited, don't do that... */
> +/* If you are writing a driver, please use dev_dbg instead */
> +#if defined(DEBUG)
> +#define pr_debug_ratelimited(fmt, ...) \
> + printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#else
> +#define pr_debug_ratelimited(fmt, ...) \
> + ({ if (0) printk_ratelimited(KERN_DEBUG pr_fmt(fmt), \
> + ##__VA_ARGS__); 0; })
> +#endif
> +
> +/*
> * General tracing related utility functions - trace_printk(),
> * tracing_on/tracing_off and tracing_start()/tracing_stop
> *
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
next prev parent reply other threads:[~2012-01-24 14:46 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-23 23:42 [00/27] 2.6.32.55-longterm review Greg KH
2012-01-23 23:40 ` [01/27] ext4: fix undefined behavior in ext4_fill_flex_info() Greg KH
2012-01-23 23:40 ` [02/27] ALSA: snd-usb-us122l: Delete calls to preempt_disable Greg KH
2012-01-23 23:40 ` [03/27] ALSA: ice1724 - Check for ac97 to avoid kernel oops Greg KH
2012-01-23 23:40 ` [04/27] ALSA: hda - Return the error from get_wcaps_type() for invalid NIDs Greg KH
2012-01-23 23:40 ` [05/27] HID: bump maximum global item tag report size to 96 bytes Greg KH
2012-01-23 23:40 ` [06/27] UBI: fix use-after-free on error path Greg KH
2012-01-23 23:40 ` [07/27] PCI: Fix PCI_EXP_TYPE_RC_EC value Greg KH
2012-01-23 23:40 ` [08/27] PCI: msi: Disable msi interrupts when we initialize a pci device Greg KH
2012-01-23 23:40 ` [09/27] xen/xenbus: Reject replies with payload > XENSTORE_PAYLOAD_MAX Greg KH
2012-01-23 23:40 ` [10/27] ima: free duplicate measurement memory Greg KH
2012-01-23 23:40 ` [11/27] PNP: work around Dell 1536/1546 BIOS MMCONFIG bug that breaks USB Greg KH
2012-01-23 23:40 ` [12/27] x86: Fix mmap random address range Greg KH
2012-01-23 23:40 ` [13/27] UBI: fix nameless volumes handling Greg KH
2012-01-23 23:41 ` [14/27] i2c: Fix error value returned by several bus drivers Greg KH
2012-01-23 23:41 ` [15/27] [media] V4L/DVB: v4l2-ioctl: integer overflow in video_usercopy() Greg KH
2012-01-23 23:41 ` [16/27] svcrpc: fix double-free on shutdown of nfsd after changing pool mode Greg KH
2012-01-23 23:41 ` [17/27] svcrpc: destroy server sockets all at once Greg KH
2012-01-23 23:41 ` [18/27] nfsd: Fix oops when parsing a 0 length export Greg KH
2012-01-23 23:41 ` [19/27] USB: cdc-wdm: fix misuse of logical operation in place of bitop Greg KH
2012-01-23 23:41 ` [20/27] [S390] fix cputime overflow in uptime_proc_show Greg KH
2012-01-23 23:41 ` [21/27] USB: Fix bad dma problem on WDM device disconnect Greg KH
2012-01-23 23:41 ` [22/27] block: add and use scsi_blk_cmd_ioctl Greg KH
2012-01-23 23:41 ` [23/27] kernel.h: add printk_ratelimited and pr_<level>_rl Greg KH
2012-01-24 14:46 ` Phil Carmody [this message]
2012-01-24 16:35 ` Ben Hutchings
2012-01-24 16:43 ` Greg KH
2012-01-23 23:41 ` [24/27] ALSA: HDA: Fix internal microphone on Dell Studio 16 XPS 1645 Greg KH
2012-01-23 23:41 ` [25/27] [SCSI] sym53c8xx: Fix NULL pointer dereference in slave_destroy Greg KH
2012-01-23 23:41 ` [26/27] score: fix off-by-one index into syscall table Greg KH
2012-01-23 23:41 ` [27/27] kprobes: initialize before using a hlist Greg KH
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=20120124144613.GD3180@pcarmody2.research.nokia.com \
--to=ext-phil.2.carmody@nokia.com \
--cc=JBottomley@parallels \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=axboe@kernel.dk \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=pmatouse@redhat.com \
--cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).