vmstat: Make ZONE_DMA support configurable Do not display ZONE_DMA counters if no DMA zone is available. Signed-off-by: Christoph Lameter Index: linux-2.6.18-rc5-mm1/include/linux/vmstat.h =================================================================== --- linux-2.6.18-rc5-mm1.orig/include/linux/vmstat.h 2006-09-01 16:16:26.000000000 -0700 +++ linux-2.6.18-rc5-mm1/include/linux/vmstat.h 2006-09-02 20:21:09.000000000 -0700 @@ -17,6 +17,12 @@ * generated will simply be the increment of a global address. */ +#ifdef CONFIG_ZONE_DMA +#define DMA_ZONE(xx) xx##_DMA, +#else +#define DMA_ZONE(xx) +#endif + #ifdef CONFIG_ZONE_DMA32 #define DMA32_ZONE(xx) xx##_DMA32, #else @@ -29,7 +35,7 @@ #define HIGHMEM_ZONE(xx) #endif -#define FOR_ALL_ZONES(xx) xx##_DMA, DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx) +#define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx) enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, FOR_ALL_ZONES(PGALLOC), @@ -87,9 +93,13 @@ #endif /* CONFIG_VM_EVENT_COUNTERS */ +#ifdef CONFIG_ZONE_DMA #define __count_zone_vm_events(item, zone, delta) \ __count_vm_events(item##_DMA + zone_idx(zone), delta) - +#else +#define __count_zone_vm_events(item, zone, delta) \ + __count_vm_events(item##_NORMAL + zone_idx(zone), delta) +#endif /* * Zone based page accounting with per cpu differentials. */ @@ -135,14 +145,16 @@ struct zone *zones = NODE_DATA(node)->node_zones; return +#ifdef CONFIG_ZONE_DMA + zone_page_state(&zones[ZONE_DMA], item) + +#endif #ifdef CONFIG_ZONE_DMA32 zone_page_state(&zones[ZONE_DMA32], item) + #endif - zone_page_state(&zones[ZONE_NORMAL], item) + #ifdef CONFIG_HIGHMEM zone_page_state(&zones[ZONE_HIGHMEM], item) + #endif - zone_page_state(&zones[ZONE_DMA], item); + zone_page_state(&zones[ZONE_NORMAL], item); } extern void zone_statistics(struct zonelist *, struct zone *); Index: linux-2.6.18-rc5-mm1/mm/vmstat.c =================================================================== --- linux-2.6.18-rc5-mm1.orig/mm/vmstat.c 2006-09-01 16:16:26.000000000 -0700 +++ linux-2.6.18-rc5-mm1/mm/vmstat.c 2006-09-02 20:20:11.000000000 -0700 @@ -437,6 +437,12 @@ .show = frag_show, }; +#ifdef CONFIG_ZONE_DMA +#define TEXT_FOR_DMA(xx) xx "_dma", +#else +#define TEXT_FOR_DMA(xx) +#endif + #ifdef CONFIG_ZONE_DMA32 #define TEXT_FOR_DMA32(xx) xx "_dma32", #else @@ -449,7 +455,7 @@ #define TEXT_FOR_HIGHMEM(xx) #endif -#define TEXTS_FOR_ZONES(xx) xx "_dma", TEXT_FOR_DMA32(xx) xx "_normal", \ +#define TEXTS_FOR_ZONES(xx) TEXT_FOR_DMA(xx) TEXT_FOR_DMA32(xx) xx "_normal", \ TEXT_FOR_HIGHMEM(xx) static char *vmstat_text[] = {