- BUG_ON(zone_type > ZONE_HIGHMEM);
+ BUG_ON(zone_type > ZONE_EASY_RECLAIM);
int res = ZONE_NORMAL;
- if (zone_bits & (__force int)__GFP_HIGHMEM)
- res = ZONE_HIGHMEM;
- if (zone_bits & (__force int)__GFP_DMA32)
- res = ZONE_DMA32;
- if (zone_bits & (__force int)__GFP_DMA)
+
+ if (zone_bits == fls((__force int)__GFP_DMA))
res = ZONE_DMA;
+ if (zone_bits == fls((__force int)__GFP_DMA32) &&
+ (__force int)__GFP_DMA32 == 0x02)
+ res = ZONE_DMA32;
+ if (zone_bits == fls((__force int)__GFP_HIGHMEM))
+ res = ZONE_HIGHMEM;
+ if (zone_bits == fls((__force int)__GFP_EASY_RECLAIM))
+ res = ZONE_EASY_RECLAIM;
+
return res;
}
Index: zone_reclaim/include/linux/gfp.h
===================================================================
--- zone_reclaim.orig/include/linux/gfp.h 2005-12-19 20:19:37.000000000 +0900
+++ zone_reclaim/include/linux/gfp.h 2005-12-19 20:19:56.000000000 +0900
@@ -81,7 +81,7 @@ struct vm_area_struct;
static inline int gfp_zone(gfp_t gfp)
{
- int zone = GFP_ZONEMASK & (__force int) gfp;
+ int zone = fls(GFP_ZONEMASK & (__force int) gfp);
BUG_ON(zone >= GFP_ZONETYPES);
return zone;
}