Index: linux-2.6/mm/page_alloc.c =================================================================== --- linux-2.6.orig/mm/page_alloc.c 2005-04-09 23:13:53.000000000 +1000 +++ linux-2.6/mm/page_alloc.c 2005-04-09 23:59:36.000000000 +1000 @@ -1623,6 +1623,18 @@ void __init build_percpu_pagelists(void) if (batch < 1) batch = 1; + /* + * Clamp the batch to a 2^n - 1 value. Having a power + * of 2 value was found to be more likely to have + * suboptimal cache aliasing properties in some cases. + * + * For example if 2 tasks are alternately allocating + * batches of pages, one task can end up with a lot + * of pages of one half of the possible page colors + * and the other with pages of the other colors. + */ + batch = (1 << fls(batch + batch/2)) - 1; + init_percpu_pageset(&zone->pageset, batch); for (cpu = 0; cpu < NR_CPUS; cpu++) { struct zone_pagesets *zp;