Re: [PATCH 18/22] Use allocation flags as an index to the zonewatermark

From: Mel Gorman
Date: Wed Apr 22 2009 - 13:15:10 EST


On Wed, Apr 22, 2009 at 10:11:53AM -0700, Dave Hansen wrote:
> On Wed, 2009-04-22 at 14:53 +0100, Mel Gorman wrote:
> > struct zone {
> > /* Fields commonly accessed by the page allocator */
> > - unsigned long pages_min, pages_low, pages_high;
> > + union {
> > + struct {
> > + unsigned long pages_min, pages_low, pages_high;
> > + };
> > + unsigned long pages_mark[3];
> > + };
>
> Why the union? It's a bit obfuscated for me. Why not just have a
> couple of these:
>
> static inline unsigned long zone_pages_min(struct zone *zone)
> {
> return zone->pages_mark[ALLOC_WMARK_MIN];
> }
>
> and s/zone->pages_min/zone_pages_min(zone)/
>
> ?
>

Preference of taste really. When I started a conversion to accessors, it
changed something recognised to something new that looked uglier to me.
Only one place cares about the union enough to access is via an array so
why spread it everywhere.

--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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/