From 73de519c41972b48fd3c4c5c35075bd48056495d Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Sun, 1 May 2005 08:58:36 -0700 Subject: [PATCH] --- yaml --- r: 625 b: refs/heads/master c: 8e30f272a93ec9c1d5c305c5040dfaebc880499d h: refs/heads/master i: 623: 4506dffb98eb06d74e5975313a35c080f732880b v: v3 --- [refs] | 2 +- trunk/mm/page_alloc.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 30c275a81fdf..9bd499099ae5 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 81b4082dc7666e2bc5ec229d8e837f3bafb96883 +refs/heads/master: 8e30f272a93ec9c1d5c305c5040dfaebc880499d diff --git a/trunk/mm/page_alloc.c b/trunk/mm/page_alloc.c index c73dbbc1cd8f..08e8627361a0 100644 --- a/trunk/mm/page_alloc.c +++ b/trunk/mm/page_alloc.c @@ -1671,6 +1671,18 @@ static void __init free_area_init_core(struct pglist_data *pgdat, 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; + for (cpu = 0; cpu < NR_CPUS; cpu++) { struct per_cpu_pages *pcp;