Re: [PATCH] mm: cleanup gfp_zone()

From: Al Viro
Date: Tue Sep 28 2010 - 17:41:50 EST


On Tue, Sep 28, 2010 at 02:32:39PM -0700, Andrew Morton wrote:
> > +#define ZT_SHIFT(gfp) ((__force int) (gfp) * ZONES_SHIFT)
> > #define GFP_ZONE_TABLE ( \
> > - (ZONE_NORMAL << 0 * ZONES_SHIFT) \
> > - | (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT) \
> > - | (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT) \
> > - | (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT) \
> > - | (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT) \
> > - | (OPT_ZONE_DMA << (__GFP_MOVABLE | __GFP_DMA) * ZONES_SHIFT) \
> > - | (ZONE_MOVABLE << (__GFP_MOVABLE | __GFP_HIGHMEM) * ZONES_SHIFT)\
> > - | (OPT_ZONE_DMA32 << (__GFP_MOVABLE | __GFP_DMA32) * ZONES_SHIFT)\
> > + (ZONE_NORMAL << ZT_SHIFT(0)) \
> > + | (OPT_ZONE_DMA << ZT_SHIFT(__GFP_DMA)) \
> > + | (OPT_ZONE_HIGHMEM << ZT_SHIFT(__GFP_HIGHMEM)) \
> > + | (OPT_ZONE_DMA32 << ZT_SHIFT(__GFP_DMA32)) \
> > + | (ZONE_NORMAL << ZT_SHIFT(__GFP_MOVABLE)) \
> > + | (OPT_ZONE_DMA << ZT_SHIFT(__GFP_MOVABLE | __GFP_DMA)) \
> > + | (ZONE_MOVABLE << ZT_SHIFT(__GFP_MOVABLE | __GFP_HIGHMEM)) \
> > + | (OPT_ZONE_DMA32 << ZT_SHIFT(__GFP_MOVABLE | __GFP_DMA32)) \
> > )
>
> hm. I hope these sparse warnings are sufficiently useful to justify
> all the gunk we're adding to support them.
>
> Is it actually finding any bugs?

FWIW, bitwise or done in the right-hand argumet of shift looks ugly as hell;
what the hell is that code _doing_?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/