public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcin Slusarz <marcin.slusarz@gmail.com>
To: Dave Young <hidave.darkstar@gmail.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	paulmck@linux.vnet.ibm.com
Subject: Re: [PATCH] [2/3] add WARN_ON_SECS macro
Date: Tue, 11 Mar 2008 20:20:37 +0100	[thread overview]
Message-ID: <20080311192031.GA7178@joi> (raw)
In-Reply-To: <20080310063437.GB6745@darkstar.te-china.tietoenator.com>

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

  reply	other threads:[~2008-03-11 19:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-10  6:34 [PATCH] [2/3] add WARN_ON_SECS macro Dave Young
2008-03-11 19:20 ` Marcin Slusarz [this message]
2008-03-12  0:37   ` Dave Young

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=20080311192031.GA7178@joi \
    --to=marcin.slusarz@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hidave.darkstar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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