for(i=0;i<sizeof(zones_size)/sizeof(zones_size[0]);i++)
zones_size[i] = 0;
zones_size[ZONE_DMA] = (end_iomem >> PAGE_SHIFT) - (uml_physmem >> PAGE_SHIFT);
+#ifdef CONFIG_HIGHMEM
zones_size[ZONE_HIGHMEM] = highmem >> PAGE_SHIFT;
+#endif
free_area_init(zones_size);
/*
/*
* GFP bitmasks..
+ *
+ * Zone modifiers (see linux/mmzone.h - low three bits)
+ *
+ * These may be masked by GFP_ZONEMASK to make allocations with this bit
+ * set fall back to ZONE_NORMAL.
+ *
+ * Do not put any conditional on these. If necessary modify the definitions
+ * without the underscores and use the consistently. The definitions here may
+ * be used in bit comparisons.
*/
-/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */
#define __GFP_DMA ((__force gfp_t)0x01u)
#define __GFP_HIGHMEM ((__force gfp_t)0x02u)
-#ifndef CONFIG_ZONE_DMA32
-#define __GFP_DMA32 ((__force gfp_t)0x01) /* ZONE_DMA is ZONE_DMA32 */
-#elif BITS_PER_LONG < 64
-#define __GFP_DMA32 ((__force gfp_t)0x00) /* ZONE_NORMAL is ZONE_DMA32 */
-#else
-#define __GFP_DMA32 ((__force gfp_t)0x04) /* Has own ZONE_DMA32 */
-#endif
+#define __GFP_DMA32 ((__force gfp_t)0x04u)
/*
* Action modifiers - doesn't change the zoning
* transfers to all addressable memory.
*/
ZONE_NORMAL,
+#ifdef CONFIG_HIGHMEM
/*
* A memory area that is only addressable by the kernel through
* mapping portions into its own address space. This is for example
* access.
*/
ZONE_HIGHMEM,
-
+#endif
MAX_NR_ZONES
};
-#define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */
/*
* When a memory allocation must conform to specific limitations (such
*
* NOTE! Make sure this matches the zones in <linux/gfp.h>
*/
-#define GFP_ZONETYPES ((GFP_ZONEMASK + 1) / 2 + 1) /* Loner */
#ifdef CONFIG_ZONE_DMA32
+
+#ifdef CONFIG_HIGHMEM
+#define GFP_ZONETYPES ((GFP_ZONEMASK + 1) / 2 + 1) /* Loner */
#define GFP_ZONEMASK 0x07
+#define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */
#else
+#define GFP_ZONETYPES ((0x07 + 1) / 2 + 1) /* Loner */
+/* Mask __GFP_HIGHMEM */
+#define GFP_ZONEMASK 0x05
+#define ZONES_SHIFT 2
+#endif
+
+#else
+#ifdef CONFIG_HIGHMEM
+
#define GFP_ZONEMASK 0x03
+#define ZONES_SHIFT 2
+#define GFP_ZONETYPES 3
+
+#else
+
+#define GFP_ZONEMASK 0x01
+#define ZONES_SHIFT 1
+#define GFP_ZONETYPES 2
+
+#endif
#endif
struct zone {
static inline int is_highmem_idx(enum zone_type idx)
{
+#ifdef CONFIG_HIGHMEM
return (idx == ZONE_HIGHMEM);
+#else
+ return 0;
+#endif
}
static inline int is_normal_idx(enum zone_type idx)
*/
static inline int is_highmem(struct zone *zone)
{
+#ifdef CONFIG_HIGHMEM
return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM;
+#else
+ return 0;
+#endif
}
static inline int is_normal(struct zone *zone)
#ifdef CONFIG_ZONE_DMA32
256,
#endif
+#ifdef CONFIG_HIGHMEM
32
+#endif
};
EXPORT_SYMBOL(totalram_pages);
"DMA32",
#endif
"Normal",
+#ifdef CONFIG_HIGHMEM
"HighMem"
+#endif
};
int min_free_kbytes = 1024;
static inline int highest_zone(int zone_bits)
{
int res = ZONE_NORMAL;
+#ifdef CONFIG_HIGHMEM
if (zone_bits & (__force int)__GFP_HIGHMEM)
res = ZONE_HIGHMEM;
+#endif
#ifdef CONFIG_ZONE_DMA32
if (zone_bits & (__force int)__GFP_DMA32)
res = ZONE_DMA32;