highmem: Allow to compile out ZONE_HIGHMEM This effectively reduces the number of zones to 3. ZONE_HIGHMEM is only defined if CONFIG_HIGHMEM is defined. We drop the vm highmem counters if CONFIG_HIGHMEM is not on. Signed-off: Index: linux-2.6.17-mm3/include/linux/mmzone.h =================================================================== --- linux-2.6.17-mm3.orig/include/linux/mmzone.h 2006-06-28 12:54:23.402967800 -0700 +++ linux-2.6.17-mm3/include/linux/mmzone.h 2006-06-28 12:59:04.162961405 -0700 @@ -90,9 +90,14 @@ struct per_cpu_pageset { #define ZONE_DMA 0 #define ZONE_DMA32 1 #define ZONE_NORMAL 2 +#ifdef CONFIG_HIGHMEM #define ZONE_HIGHMEM 3 #define MAX_NR_ZONES 4 /* Sync this with ZONES_SHIFT */ +#else +#define MAX_NR_ZONES 3 +#endif + #define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */ Index: linux-2.6.17-mm3/mm/page_alloc.c =================================================================== --- linux-2.6.17-mm3.orig/mm/page_alloc.c 2006-06-28 12:54:23.404920804 -0700 +++ linux-2.6.17-mm3/mm/page_alloc.c 2006-06-28 12:59:28.921196945 -0700 @@ -85,7 +85,9 @@ static char *zone_names[MAX_NR_ZONES] = "DMA", "DMA32", "Normal", +#ifdef CONFIG_HIGHMEM "HighMem" +#endif }; int min_free_kbytes = 1024; @@ -1256,8 +1258,13 @@ void si_meminfo_node(struct sysinfo *val val->totalram = pgdat->node_present_pages; val->freeram = nr_free_pages_pgdat(pgdat); +#ifdef CONFIG_HIGHMEM val->totalhigh = pgdat->node_zones[ZONE_HIGHMEM].present_pages; val->freehigh = pgdat->node_zones[ZONE_HIGHMEM].free_pages; +#else + val->totalhigh = 0; + val->freehigh = 0; +#endif val->mem_unit = PAGE_SIZE; } #endif Index: linux-2.6.17-mm3/mm/swap_prefetch.c =================================================================== --- linux-2.6.17-mm3.orig/mm/swap_prefetch.c 2006-06-27 09:40:25.624505390 -0700 +++ linux-2.6.17-mm3/mm/swap_prefetch.c 2006-06-28 12:59:04.178585439 -0700 @@ -277,8 +277,11 @@ static void examine_free_limits(void) ns = &sp_stat.node[z->zone_pgdat->node_id]; idx = zone_idx(z); - ns->lowfree[idx] = z->pages_high * 3 + - z->lowmem_reserve[ZONE_HIGHMEM]; + ns->lowfree[idx] = z->pages_high * 3 +#ifdef CONFIG_HIGHMEM + + z->lowmem_reserve[ZONE_HIGHMEM] +#endif +; ns->highfree[idx] = ns->lowfree[idx] + z->pages_high; if (z->free_pages > ns->highfree[idx]) { Index: linux-2.6.17-mm3/include/linux/vmstat.h =================================================================== --- linux-2.6.17-mm3.orig/include/linux/vmstat.h 2006-06-27 12:07:19.842119270 -0700 +++ linux-2.6.17-mm3/include/linux/vmstat.h 2006-06-28 12:59:04.179561941 -0700 @@ -18,7 +18,11 @@ * generated will simply be the increment of a global address. */ +#ifdef CONFIG_HIGHMEM #define FOR_ALL_ZONES(x) x##_DMA, x##_DMA32, x##_NORMAL, x##_HIGH +#else +#define FOR_ALL_ZONES(x) x##_DMA, x##_DMA32, x##_NORMAL +#endif enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, FOR_ALL_ZONES(PGALLOC), Index: linux-2.6.17-mm3/mm/vmstat.c =================================================================== --- linux-2.6.17-mm3.orig/mm/vmstat.c 2006-06-28 12:50:30.110742333 -0700 +++ linux-2.6.17-mm3/mm/vmstat.c 2006-06-28 13:01:49.228931745 -0700 @@ -394,8 +394,13 @@ struct seq_operations fragmentation_op = .show = frag_show, }; -#define MAKE_PER_ZONE_TEXTS(x) x "_dma", x "_dma32", x "_normal", x "_high" +#ifdef CONFIG_HIGHMEM +#define MAKE_PER_ZONE_TEXTS(x) x "_dma", x "_dma32", x "_normal", x "_high" +#else +#define MAKE_PER_ZONE_TEXTS(x) x "_dma", x "_dma32", x "_normal" +#endif + static char *vmstat_text[] = { /* Zoned VM counters */ "nr_anon_pages",