diff options
author | Nick Piggin <nickpiggin@yahoo.com.au> | 2005-05-01 11:58:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-01 11:58:36 -0400 |
commit | 8e30f272a93ec9c1d5c305c5040dfaebc880499d (patch) | |
tree | ed5b54d2895d3e93768f79b2ec2b968f79bf7013 /mm/page_alloc.c | |
parent | 81b4082dc7666e2bc5ec229d8e837f3bafb96883 (diff) |
[PATCH] mm: pcp use non powers of 2 for batch size
Jack Steiner reported this to have fixed his problem (bad colouring):
"The patches fix both problems that I found - bad
coloring & excessive pages in pagesets."
In most workloads this is not likely to be such a pronounced problem,
however it should help corner cases. And avoiding powers of 2 in these
types of memory operations is always a good idea.
Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c73dbbc1cd8f..08e8627361a0 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1671,6 +1671,18 @@ static void __init free_area_init_core(struct pglist_data *pgdat, | |||
1671 | if (batch < 1) | 1671 | if (batch < 1) |
1672 | batch = 1; | 1672 | batch = 1; |
1673 | 1673 | ||
1674 | /* | ||
1675 | * Clamp the batch to a 2^n - 1 value. Having a power | ||
1676 | * of 2 value was found to be more likely to have | ||
1677 | * suboptimal cache aliasing properties in some cases. | ||
1678 | * | ||
1679 | * For example if 2 tasks are alternately allocating | ||
1680 | * batches of pages, one task can end up with a lot | ||
1681 | * of pages of one half of the possible page colors | ||
1682 | * and the other with pages of the other colors. | ||
1683 | */ | ||
1684 | batch = (1 << fls(batch + batch/2)) - 1; | ||
1685 | |||
1674 | for (cpu = 0; cpu < NR_CPUS; cpu++) { | 1686 | for (cpu = 0; cpu < NR_CPUS; cpu++) { |
1675 | struct per_cpu_pages *pcp; | 1687 | struct per_cpu_pages *pcp; |
1676 | 1688 | ||