On Fri, 8 Feb 2008, Andrew Morton wrote:
> >  #ifdef CONFIG_HIGHMEM
> > -   int zone_idx = zone - zone->zone_pgdat->node_zones;
> > -   return zone_idx == ZONE_HIGHMEM ||
> > -           (zone_idx == ZONE_MOVABLE && zone_movable_is_highmem());
> > +   const int highmem_off = ZONE_HIGHMEM * sizeof(*zone);
> > +   const int movable_off = ZONE_MOVABLE * sizeof(*zone);
> > +
> > +   int zone_off = (unsigned long)zone - (unsigned 
> > long)zone->zone_pgdat->node_zones;
> > +   return zone_off == highmem_off ||
> > +           (zone_off == movable_off && zone_movable_is_highmem());
> 
> hrm.  For my i386 build (and that's where CONFIG_HIGHMEM really matters)
> this patch makes mm/page_alloc.o six bytes larger, and I don't think the
> change did much for readability.

Heh, yeah. That's a very odd way to write it.

It would probably make more sense to just write it as something like

        struct zone *base = zone->zone_pgdat->node_zones;

        if (zone == base + ZONE_HIGHMEM ||
                (zone == base + ZONE_MOVABLE && zone_movable_is_highmem());

instead.

The above is totally untested, of course.

                Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to