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:34:13.130103415 -0700 +++ linux-2.6.17-mm4/mm/vmstat.c 2006-06-30 09:44:42.106442018 -0700 @@ -182,6 +182,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 (STAT_THRESHOLD / 2) + static void __inc_zone_state(struct zone *zone, enum zone_stat_item item) { s8 *p = diff_pointer(zone, item); @@ -189,8 +192,8 @@ static void __inc_zone_state(struct zone (*p)++; if (unlikely(*p > STAT_THRESHOLD)) { - zone_page_state_add(*p, zone, item); - *p = 0; + zone_page_state_add(*p + balance_factor, zone, item); + *p = -balance_factor; } } @@ -208,8 +211,8 @@ void __dec_zone_page_state(struct page * (*p)--; if (unlikely(*p < -STAT_THRESHOLD)) { - zone_page_state_add(*p, zone, item); - *p = 0; + zone_page_state_add(*p - balance_factor, zone, item); + *p = balance_factor; } } EXPORT_SYMBOL(__dec_zone_page_state);