linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave@sr71.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	Jan Beulich <JBeulich@novell.com>,
	Christoph Lameter <cl@linux.com>, linux-mm <linux-mm@kvack.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: BUILD_BUG_ON() breaks sparse gfp_t checks
Date: Thu, 14 Apr 2011 14:39:51 -0700	[thread overview]
Message-ID: <1302817191.16562.1036.camel@nimitz> (raw)
In-Reply-To: <20110414132220.970cfb2a.akpm@linux-foundation.org>

On Thu, 2011-04-14 at 13:22 -0700, Andrew Morton wrote:
> The kernel calls gfp_zone() with a constant arg in very few places. 
> This?
> 
> --- a/include/linux/gfp.h~a
> +++ a/include/linux/gfp.h
> @@ -249,14 +249,9 @@ static inline enum zone_type gfp_zone(gf
>  
>         z = (GFP_ZONE_TABLE >> (bit * ZONES_SHIFT)) &
>                                          ((1 << ZONES_SHIFT) - 1);
> -
> -       if (__builtin_constant_p(bit))
> -               BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
> -       else {
>  #ifdef CONFIG_DEBUG_VM
> -               BUG_ON((GFP_ZONE_BAD >> bit) & 1);
> +       BUG_ON((GFP_ZONE_BAD >> bit) & 1);
>  #endif
> -       }
>         return z;
>  } 

That definitely makes sparse happier.  I hope the folks on cc will chime
in if they wanted something special at build time.

-- Dave

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-04-14 21:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-14 15:41 BUILD_BUG_ON() breaks sparse gfp_t checks Dave Hansen
2011-04-14 20:22 ` Andrew Morton
2011-04-14 21:39   ` Dave Hansen [this message]
2011-04-15 14:45     ` Christoph Lameter
2011-04-15 19:16       ` [PATCH] make new gfp.h BUG_ON() in to VM_BUG_ON() Dave Hansen

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=1302817191.16562.1036.camel@nimitz \
    --to=dave@sr71.net \
    --cc=JBeulich@novell.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rusty@rustcorp.com.au \
    /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;
as well as URLs for NNTP newsgroup(s).