Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754361AbYCMAo6 (ORCPT ); Wed, 12 Mar 2008 20:44:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750959AbYCMAou (ORCPT ); Wed, 12 Mar 2008 20:44:50 -0400 Received: from el-out-1112.google.com ([209.85.162.180]:23362 "EHLO el-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751589AbYCMAot (ORCPT ); Wed, 12 Mar 2008 20:44:49 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=GEkvJMuUk/ijz3N0gdEbc6huvd55kCyr2hfKVSXcq2MNFuuyHUm28L7MWOTaZN4IATwLrVoLPdJIQoh+8HN1z35lCYOXJKCHNRIyTXjtz2X5cove7sBBNq/t6EEWKXUnedP/b/Tdo7HkTMpqrDRrFfKNPiBp4Nf0qdIuXC/zv+U= Message-ID: Date: Thu, 13 Mar 2008 08:44:48 +0800 From: "Dave Young" To: "Johannes Weiner" Subject: Re: [PATCH -mm] do not check condition twice in WARN_ON_SECS Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, "Marcin Slusarz" , paulmck@linux.vnet.ibm.com In-Reply-To: <87pru0oxyv.fsf@saeurebad.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080312010933.GA2957@darkstar.te-china.tietoenator.com> <87pru0oxyv.fsf@saeurebad.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1624 Lines: 40 On Wed, Mar 12, 2008 at 9:47 PM, Johannes Weiner wrote: > Hi Dave, > > > > Dave Young writes: > > > Don't check condition twice, change WARN_ON(condition) to WARN_ON(1) > > Thanks Marcin Slusarz for pointing out > > > > Signed-off-by: Dave Young > > > > --- > > 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? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/