[Devel] [PATCH RH7] ve_prink: introduce ve_pr_<level>_ratelimited
Kirill Tkhai
ktkhai at virtuozzo.com
Fri Dec 25 05:32:09 PST 2015
On 11.12.2015 19:02, Dmitry Safonov wrote:
> Simple ratelimit for ve_printk & level.
>
> https://jira.sw.ru/browse/PSBM-42313
>
> Signed-off-by: Dmitry Safonov <dsafonov at odin.com>
Looks good for me, the only thing formatting in the first hunk's end '\' has gone right.
Maybe, it's only in my editor, but below looks better:
Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 87bc842..4db50c4 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -345,9 +345,21 @@ extern void dump_stack(void) __cold;
if (__ratelimit(&_rs)) \
printk(fmt, ##__VA_ARGS__); \
})
+
+#define ve_printk_ratelimited(dst, fmt, ...) \
+({ \
+ static DEFINE_RATELIMIT_STATE(_rs, \
+ DEFAULT_RATELIMIT_INTERVAL, \
+ DEFAULT_RATELIMIT_BURST); \
+ \
+ if (__ratelimit(&_rs)) \
+ ve_printk(dst, fmt, ##__VA_ARGS__); \
+})
#else
#define printk_ratelimited(fmt, ...) \
no_printk(fmt, ##__VA_ARGS__)
+#define ve_printk_ratelimited(dst, fmt, ...) \
+ no_printk(fmt, ##__VA_ARGS__)
#endif
#define pr_emerg_ratelimited(fmt, ...) \
@@ -365,6 +377,20 @@ extern void dump_stack(void) __cold;
#define pr_info_ratelimited(fmt, ...) \
printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
/* no pr_cont_ratelimited, don't do that... */
+#define ve_pr_emerg_ratelimited(dst, fmt, ...) \
+ ve_printk_ratelimited(dst, KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
+#define ve_pr_alert_ratelimited(dst, fmt, ...) \
+ ve_printk_ratelimited(dst, KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
+#define ve_pr_crit_ratelimited(dst, fmt, ...) \
+ ve_printk_ratelimited(dst, KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
+#define ve_pr_err_ratelimited(dst, fmt, ...) \
+ ve_printk_ratelimited(dst, KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
+#define ve_pr_warn_ratelimited(dst, fmt, ...) \
+ ve_printk_ratelimited(dst, KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
+#define ve_pr_notice_ratelimited(dst, fmt, ...) \
+ ve_printk_ratelimited(dst, KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
+#define ve_pr_info_ratelimited(dst, fmt, ...) \
+ ve_printk_ratelimited(dst, KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
#if defined(DEBUG)
#define pr_devel_ratelimited(fmt, ...) \
More information about the Devel
mailing list