Re: [PATCH 24/27] Convert gfp_zone() to use a table of precalculatedvalues

From: Christoph Lameter
Date: Thu Mar 19 2009 - 14:18:38 EST


On Thu, 19 Mar 2009, Mel Gorman wrote:

> I ran into exactly that problem and ended up shoving the table into
> page_alloc.c but then there is no benefits from having the table statically
> declared because there is no constant folding.

Right. The table must be defined in the .h file. Just a matter of figuring
out how to convince the compiler/linker to do the right thing.

> > + if (__builtin_constant_p(zone))
> > + BUILD_BUG_ON(zone == BAD_ZONE);
> > +#ifdef CONFIG_DEBUG_VM
> > + else
> > + BUG_ON(zone == BAD_ZONE);
> > #endif
>
> That could be made a bit prettier with
>
> if (__builtin_constant_p(zone))
> BUILD_BUG_ON(zone == BAD_ZONE);
> VM_BUG_ON(zone == BAD_ZONE);

VM_BUG_ON is not available here. It has to be that ugly.
--
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/