ZVC: overcompensate while incrementing ZVC counters Overcompensate by a balance factor when incrementing or decrementing ZVC counters anticipating continual increase in the same direction. Note that I have not (yet) been able to see any effect off this approach on an 8p system where I tested this. I probably will have a chance to test it on larger systems (160p) tomorrow. Signed-off-by: Christoph Lameter Index: linux-2.6.17-mm4/mm/vmstat.c =================================================================== --- linux-2.6.17-mm4.orig/mm/vmstat.c 2006-06-29 13:35:16.959161608 -0700 +++ linux-2.6.17-mm4/mm/vmstat.c 2006-06-29 13:54:46.361438715 -0700 @@ -167,6 +167,9 @@ EXPORT_SYMBOL(mod_zone_page_state); * in between and therefore the atomicity vs. interrupt cannot be exploited * in a useful way here. */ + +#define balance_factor(x) (x->stat_threshold / 2) + static void __inc_zone_state(struct zone *zone, enum zone_stat_item item) { struct per_cpu_pageset *pcp = zone_pcp(zone, smp_processor_id()); @@ -175,8 +178,8 @@ static void __inc_zone_state(struct zone (*p)++; if (unlikely(*p > pcp->stat_threshold)) { - zone_page_state_add(*p, zone, item); - *p = 0; + zone_page_state_add(*p + balance_factor(pcp), zone, item); + *p = -balance_factor(pcp); } } @@ -195,8 +198,8 @@ void __dec_zone_page_state(struct page * (*p)--; if (unlikely(*p < -pcp->stat_threshold)) { - zone_page_state_add(*p, zone, item); - *p = 0; + zone_page_state_add(*p - balance_factor(pcp), zone, item); + *p = balance_factor(pcp); } } EXPORT_SYMBOL(__dec_zone_page_state);