LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] [2/3] add WARN_ON_SECS macro
@ 2008-03-10 6:34 Dave Young
2008-03-11 19:20 ` Marcin Slusarz
0 siblings, 1 reply; 3+ messages in thread
From: Dave Young @ 2008-03-10 6:34 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, paulmck
Add WARN_ON_SECS macro for some serious case which need repeat the
warnings, but with some ratelimit.
Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
---
include/asm-generic/bug.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff -upr linux/include/asm-generic/bug.h linux.new/include/asm-generic/bug.h
--- linux/include/asm-generic/bug.h 2008-03-10 13:27:03.000000000 +0800
+++ linux.new/include/asm-generic/bug.h 2008-03-10 13:27:14.000000000 +0800
@@ -3,6 +3,7 @@
#include <linux/compiler.h>
+
#ifdef CONFIG_BUG
#ifdef CONFIG_GENERIC_BUG
@@ -75,6 +76,13 @@ extern void warn_on_slowpath(const char
unlikely(__ret_warn_once); \
})
+#define WARN_ON_SECS(condition, secs) ({ \
+ int __ret_warn_on = !!(condition); \
+ if (unlikely(__ret_warn_on)) \
+ if (__ratelimit(secs * HZ, 1)) \
+ WARN_ON(condition); \
+})
+
#ifdef CONFIG_SMP
# define WARN_ON_SMP(x) WARN_ON(x)
#else
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [2/3] add WARN_ON_SECS macro
2008-03-10 6:34 [PATCH] [2/3] add WARN_ON_SECS macro Dave Young
@ 2008-03-11 19:20 ` Marcin Slusarz
2008-03-12 0:37 ` Dave Young
0 siblings, 1 reply; 3+ messages in thread
From: Marcin Slusarz @ 2008-03-11 19:20 UTC (permalink / raw)
To: Dave Young; +Cc: linux-kernel, akpm, paulmck
On Mon, Mar 10, 2008 at 02:34:37PM +0800, Dave Young wrote:
> Add WARN_ON_SECS macro for some serious case which need repeat the
> warnings, but with some ratelimit.
>
> Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
>
> ---
> include/asm-generic/bug.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff -upr linux/include/asm-generic/bug.h linux.new/include/asm-generic/bug.h
> --- linux/include/asm-generic/bug.h 2008-03-10 13:27:03.000000000 +0800
> +++ linux.new/include/asm-generic/bug.h 2008-03-10 13:27:14.000000000 +0800
> @@ -3,6 +3,7 @@
>
> #include <linux/compiler.h>
>
> +
> #ifdef CONFIG_BUG
>
> #ifdef CONFIG_GENERIC_BUG
> @@ -75,6 +76,13 @@ extern void warn_on_slowpath(const char
> unlikely(__ret_warn_once); \
> })
>
> +#define WARN_ON_SECS(condition, secs) ({ \
> + int __ret_warn_on = !!(condition); \
> + if (unlikely(__ret_warn_on)) \
> + if (__ratelimit(secs * HZ, 1)) \
> + WARN_ON(condition); \
> +})
> +
> #ifdef CONFIG_SMP
> # define WARN_ON_SMP(x) WARN_ON(x)
> #else
Do you really want to check the condition twice?
Marcin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [2/3] add WARN_ON_SECS macro
2008-03-11 19:20 ` Marcin Slusarz
@ 2008-03-12 0:37 ` Dave Young
0 siblings, 0 replies; 3+ messages in thread
From: Dave Young @ 2008-03-12 0:37 UTC (permalink / raw)
To: Marcin Slusarz; +Cc: linux-kernel, akpm, paulmck
On Wed, Mar 12, 2008 at 3:20 AM, Marcin Slusarz
<marcin.slusarz@gmail.com> wrote:
>
> On Mon, Mar 10, 2008 at 02:34:37PM +0800, Dave Young wrote:
> > Add WARN_ON_SECS macro for some serious case which need repeat the
> > warnings, but with some ratelimit.
> >
> > Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
> >
> > ---
> > include/asm-generic/bug.h | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff -upr linux/include/asm-generic/bug.h linux.new/include/asm-generic/bug.h
> > --- linux/include/asm-generic/bug.h 2008-03-10 13:27:03.000000000 +0800
> > +++ linux.new/include/asm-generic/bug.h 2008-03-10 13:27:14.000000000 +0800
> > @@ -3,6 +3,7 @@
> >
> > #include <linux/compiler.h>
> >
> > +
> > #ifdef CONFIG_BUG
> >
> > #ifdef CONFIG_GENERIC_BUG
> > @@ -75,6 +76,13 @@ extern void warn_on_slowpath(const char
> > unlikely(__ret_warn_once); \
> > })
> >
> > +#define WARN_ON_SECS(condition, secs) ({ \
> > + int __ret_warn_on = !!(condition); \
> > + if (unlikely(__ret_warn_on)) \
> > + if (__ratelimit(secs * HZ, 1)) \
> > + WARN_ON(condition); \
> > +})
> > +
> > #ifdef CONFIG_SMP
> > # define WARN_ON_SMP(x) WARN_ON(x)
> > #else
>
> Do you really want to check the condition twice?
Thanks, WARN_ON(1) will be better.
>
> Marcin
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-12 0:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-10 6:34 [PATCH] [2/3] add WARN_ON_SECS macro Dave Young
2008-03-11 19:20 ` Marcin Slusarz
2008-03-12 0:37 ` Dave Young
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).