public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@saeurebad.de>
To: Dave Young <hidave.darkstar@gmail.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Marcin Slusarz <marcin.slusarz@gmail.com>,
	paulmck@linux.vnet.ibm.com
Subject: Re: [PATCH -mm] do not check condition twice in WARN_ON_SECS
Date: Wed, 12 Mar 2008 14:47:52 +0100	[thread overview]
Message-ID: <87pru0oxyv.fsf@saeurebad.de> (raw)
In-Reply-To: <20080312010933.GA2957@darkstar.te-china.tietoenator.com> (Dave Young's message of "Wed, 12 Mar 2008 09:09:33 +0800")

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

  reply	other threads:[~2008-03-12 13:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2008-03-13  0:44   ` Dave Young
2008-03-13  4:47   ` Linus Torvalds

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=87pru0oxyv.fsf@saeurebad.de \
    --to=hannes@saeurebad.de \
    --cc=akpm@linux-foundation.org \
    --cc=hidave.darkstar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcin.slusarz@gmail.com \
    --cc=paulmck@linux.vnet.ibm.com \
    /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