[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0902241112310.22519@qirst.com>
Date: Tue, 24 Feb 2009 11:43:29 -0500 (EST)
From: Christoph Lameter <cl@...ux-foundation.org>
To: Mel Gorman <mel@....ul.ie>
cc: Linux Memory Management List <linux-mm@...ck.org>,
Pekka Enberg <penberg@...helsinki.fi>,
Rik van Riel <riel@...hat.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Johannes Weiner <hannes@...xchg.org>,
Nick Piggin <npiggin@...e.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Lin Ming <ming.m.lin@...el.com>,
Zhang Yanmin <yanmin_zhang@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH 04/19] Convert gfp_zone() to use a table of precalculated
values
On Tue, 24 Feb 2009, Mel Gorman wrote:
> static inline enum zone_type gfp_zone(gfp_t flags)
> {
> -#ifdef CONFIG_ZONE_DMA
> - if (flags & __GFP_DMA)
> - return ZONE_DMA;
> -#endif
> -#ifdef CONFIG_ZONE_DMA32
> - if (flags & __GFP_DMA32)
> - return ZONE_DMA32;
> -#endif
> - if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) ==
> - (__GFP_HIGHMEM | __GFP_MOVABLE))
> - return ZONE_MOVABLE;
> -#ifdef CONFIG_HIGHMEM
> - if (flags & __GFP_HIGHMEM)
> - return ZONE_HIGHMEM;
> -#endif
> - return ZONE_NORMAL;
> + return gfp_zone_table[flags & GFP_ZONEMASK];
> }
Aassume
GFP_DMA = 0x01
GFP_DMA32 = 0x02
GFP_MOVABLE = 0x04
GFP_HIGHMEM = 0x08
ZONE_NORMAL = 0
ZONE_DMA = 1
ZONE_DMA32 = 2
ZONE_MOVABLE = 3
ZONE_HIGHMEM = 4
then we could implement gfp_zone simply as:
static inline enum zone_type gfp_zone(gfp_t flags)
{
return ffs(flags & 0xf);
}
However, this would return ZONE_MOVABLE if only GFP_MOVABLE would be
set but not GFP_HIGHMEM.
If we could make sure that GFP_MOVABLE always includes GFP_HIGHMEM then
this would not be a problem.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists