Single zone vmstat optimizations. If we have a single zone and the system is not a NUMA system then we have no need of keeping separate global and per zone statistics. Both are the same. So get rid of the statistics in a zone. The optimization is mainly useful for embedded systems. Signed-off-by: Christoph Lameter Index: linux-2.6.18-rc6-mm2/include/linux/mmzone.h =================================================================== --- linux-2.6.18-rc6-mm2.orig/include/linux/mmzone.h 2006-09-18 21:18:44.420945477 -0500 +++ linux-2.6.18-rc6-mm2/include/linux/mmzone.h 2006-09-18 21:20:30.272491662 -0500 @@ -223,8 +223,10 @@ struct zone { /* A count of how many reclaimers are scanning this zone */ atomic_t reclaim_in_progress; +#if defined(CONFIG_NUMA) || defined(MULTI_ZONE) /* Zone statistics */ atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; +#endif /* * prev_priority holds the scanning priority for this zone. It is Index: linux-2.6.18-rc6-mm2/include/linux/vmstat.h =================================================================== --- linux-2.6.18-rc6-mm2.orig/include/linux/vmstat.h 2006-09-18 21:17:51.114771679 -0500 +++ linux-2.6.18-rc6-mm2/include/linux/vmstat.h 2006-09-18 21:20:30.360389574 -0500 @@ -105,7 +105,9 @@ extern atomic_long_t vm_stat[NR_VM_ZONE_ static inline void zone_page_state_add(long x, struct zone *zone, enum zone_stat_item item) { +#if defined(CONFIG_NUMA) || defined(MULTI_ZONE) atomic_long_add(x, &zone->vm_stat[item]); +#endif atomic_long_add(x, &vm_stat[item]); } @@ -122,11 +124,17 @@ static inline unsigned long global_page_ static inline unsigned long zone_page_state(struct zone *zone, enum zone_stat_item item) { - long x = atomic_long_read(&zone->vm_stat[item]); + long x; + +#if defined(CONFIG_NUMA) || defined(MULTI_ZONE) + x = atomic_long_read(&zone->vm_stat[item]); #ifdef CONFIG_SMP if (x < 0) x = 0; #endif +#else + x = atomic_long_read(&vm_stat[item]); +#endif return x; } @@ -173,7 +181,9 @@ extern void zone_statistics(struct zonel static inline void zap_zone_vm_stats(struct zone *zone) { +#if defined(CONFIG_NUMA) || defined(MULTI_ZONE) memset(zone->vm_stat, 0, sizeof(zone->vm_stat)); +#endif } extern void inc_zone_state(struct zone *, enum zone_stat_item); @@ -206,7 +216,9 @@ static inline void __mod_zone_page_state static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item) { +#if defined(CONFIG_NUMA) || defined(MULTI_ZONE) atomic_long_inc(&zone->vm_stat[item]); +#endif atomic_long_inc(&vm_stat[item]); } @@ -219,7 +231,9 @@ static inline void __inc_zone_page_state static inline void __dec_zone_page_state(struct page *page, enum zone_stat_item item) { +#if defined(CONFIG_NUMA) || defined(MULTI_ZONE) atomic_long_dec(&page_zone(page)->vm_stat[item]); +#endif atomic_long_dec(&vm_stat[item]); }