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-mm1/include/linux/mmzone.h =================================================================== --- linux-2.6.18-rc6-mm1.orig/include/linux/mmzone.h 2006-09-11 20:51:31.000000000 -0500 +++ linux-2.6.18-rc6-mm1/include/linux/mmzone.h 2006-09-11 20:51:41.668285121 -0500 @@ -221,8 +221,10 @@ /* 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-mm1/include/linux/vmstat.h =================================================================== --- linux-2.6.18-rc6-mm1.orig/include/linux/vmstat.h 2006-09-11 20:51:07.000000000 -0500 +++ linux-2.6.18-rc6-mm1/include/linux/vmstat.h 2006-09-11 20:51:41.681958144 -0500 @@ -105,7 +105,9 @@ 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 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 @@ 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 __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 __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]); }