LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH -mm] do not check condition twice in WARN_ON_SECS
@ 2008-03-12 1:09 Dave Young
2008-03-12 13:47 ` Johannes Weiner
0 siblings, 1 reply; 4+ messages in thread
From: Dave Young @ 2008-03-12 1:09 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Marcin Slusarz, paulmck
Don't check condition twice, change WARN_ON(condition) to WARN_ON(1)
Thanks Marcin Slusarz <marcin.slusarz@gmail.com> for pointing out
Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
---
include/asm-generic/bug.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff -upr linux/include/asm-generic/bug.h linux.new/include/asm-generic/bug.h
--- linux/include/asm-generic/bug.h 2008-03-12 08:45:08.000000000 +0800
+++ linux.new/include/asm-generic/bug.h 2008-03-12 09:04:07.000000000 +0800
@@ -80,7 +80,8 @@ extern void warn_on_slowpath(const char
int __ret_warn_on = !!(condition); \
if (unlikely(__ret_warn_on)) \
if (__ratelimit(secs * HZ, 1)) \
- WARN_ON(condition); \
+ WARN_ON(1); \
+ unlikely(__ret_warn_on); \
})
#ifdef CONFIG_SMP
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -mm] do not check condition twice in WARN_ON_SECS
2008-03-12 1:09 [PATCH -mm] do not check condition twice in WARN_ON_SECS Dave Young
@ 2008-03-12 13:47 ` Johannes Weiner
2008-03-13 0:44 ` Dave Young
2008-03-13 4:47 ` Linus Torvalds
0 siblings, 2 replies; 4+ messages in thread
From: Johannes Weiner @ 2008-03-12 13:47 UTC (permalink / raw)
To: Dave Young; +Cc: akpm, linux-kernel, Marcin Slusarz, paulmck
Hi Dave,
Dave Young <hidave.darkstar@gmail.com> writes:
> Don't check condition twice, change WARN_ON(condition) to WARN_ON(1)
> Thanks Marcin Slusarz <marcin.slusarz@gmail.com> for pointing out
>
> Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
>
> ---
> include/asm-generic/bug.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff -upr linux/include/asm-generic/bug.h linux.new/include/asm-generic/bug.h
> --- linux/include/asm-generic/bug.h 2008-03-12 08:45:08.000000000 +0800
> +++ linux.new/include/asm-generic/bug.h 2008-03-12 09:04:07.000000000 +0800
> @@ -80,7 +80,8 @@ extern void warn_on_slowpath(const char
> int __ret_warn_on = !!(condition); \
> if (unlikely(__ret_warn_on)) \
> if (__ratelimit(secs * HZ, 1)) \
> - WARN_ON(condition); \
> + WARN_ON(1); \
> + unlikely(__ret_warn_on); \
> })
What's wrong with:
#define WARN_ON_SECS(condition, secs) \
WARN_ON(condition && __ratelimit(secs * HZ, 1))
?
Hannes
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -mm] do not check condition twice in WARN_ON_SECS
2008-03-12 13:47 ` Johannes Weiner
@ 2008-03-13 0:44 ` Dave Young
2008-03-13 4:47 ` Linus Torvalds
1 sibling, 0 replies; 4+ messages in thread
From: Dave Young @ 2008-03-13 0:44 UTC (permalink / raw)
To: Johannes Weiner; +Cc: akpm, linux-kernel, Marcin Slusarz, paulmck
On Wed, Mar 12, 2008 at 9:47 PM, Johannes Weiner <hannes@saeurebad.de> wrote:
> Hi Dave,
>
>
>
> Dave Young <hidave.darkstar@gmail.com> writes:
>
> > Don't check condition twice, change WARN_ON(condition) to WARN_ON(1)
> > Thanks Marcin Slusarz <marcin.slusarz@gmail.com> for pointing out
> >
> > Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
> >
> > ---
> > include/asm-generic/bug.h | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff -upr linux/include/asm-generic/bug.h linux.new/include/asm-generic/bug.h
> > --- linux/include/asm-generic/bug.h 2008-03-12 08:45:08.000000000 +0800
> > +++ linux.new/include/asm-generic/bug.h 2008-03-12 09:04:07.000000000 +0800
> > @@ -80,7 +80,8 @@ extern void warn_on_slowpath(const char
> > int __ret_warn_on = !!(condition); \
> > if (unlikely(__ret_warn_on)) \
> > if (__ratelimit(secs * HZ, 1)) \
> > - WARN_ON(condition); \
> > + WARN_ON(1); \
> > + unlikely(__ret_warn_on); \
> > })
>
> What's wrong with:
>
> #define WARN_ON_SECS(condition, secs) \
> WARN_ON(condition && __ratelimit(secs * HZ, 1))
Looks concise.
Should I update the third time?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -mm] do not check condition twice in WARN_ON_SECS
2008-03-12 13:47 ` Johannes Weiner
2008-03-13 0:44 ` Dave Young
@ 2008-03-13 4:47 ` Linus Torvalds
1 sibling, 0 replies; 4+ messages in thread
From: Linus Torvalds @ 2008-03-13 4:47 UTC (permalink / raw)
To: Johannes Weiner; +Cc: Dave Young, akpm, linux-kernel, Marcin Slusarz, paulmck
On Wed, 12 Mar 2008, Johannes Weiner wrote:
>
> What's wrong with:
>
> #define WARN_ON_SECS(condition, secs) \
> WARN_ON(condition && __ratelimit(secs * HZ, 1))
Add parenthesis around the arguments, please.
Linus
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-13 4:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-12 1:09 [PATCH -mm] do not check condition twice in WARN_ON_SECS Dave Young
2008-03-12 13:47 ` Johannes Weiner
2008-03-13 0:44 ` Dave Young
2008-03-13 4:47 ` Linus Torvalds
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).