aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 94c864eac9c4..f799217dc2f3 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1721,29 +1721,29 @@ static int __devinit zone_batchsize(struct zone *zone)
1721 1721
1722 /* 1722 /*
1723 * The per-cpu-pages pools are set to around 1000th of the 1723 * The per-cpu-pages pools are set to around 1000th of the
1724 * size of the zone. But no more than 1/4 of a meg - there's 1724 * size of the zone. But no more than 1/2 of a meg.
1725 * no point in going beyond the size of L2 cache.
1726 * 1725 *
1727 * OK, so we don't know how big the cache is. So guess. 1726 * OK, so we don't know how big the cache is. So guess.
1728 */ 1727 */
1729 batch = zone->present_pages / 1024; 1728 batch = zone->present_pages / 1024;
1730 if (batch * PAGE_SIZE > 256 * 1024) 1729 if (batch * PAGE_SIZE > 512 * 1024)
1731 batch = (256 * 1024) / PAGE_SIZE; 1730 batch = (512 * 1024) / PAGE_SIZE;
1732 batch /= 4; /* We effectively *= 4 below */ 1731 batch /= 4; /* We effectively *= 4 below */
1733 if (batch < 1) 1732 if (batch < 1)
1734 batch = 1; 1733 batch = 1;
1735 1734
1736 /* 1735 /*
1737 * Clamp the batch to a 2^n - 1 value. Having a power 1736 * We will be trying to allcoate bigger chunks of contiguous
1738 * of 2 value was found to be more likely to have 1737 * memory of the order of fls(batch). This should result in
1739 * suboptimal cache aliasing properties in some cases. 1738 * better cache coloring.
1740 * 1739 *
1741 * For example if 2 tasks are alternately allocating 1740 * A sanity check also to ensure that batch is still in limits.
1742 * batches of pages, one task can end up with a lot
1743 * of pages of one half of the possible page colors
1744 * and the other with pages of the other colors.
1745 */ 1741 */
1746 batch = (1 << fls(batch + batch/2)) - 1; 1742 batch = (1 << fls(batch + batch/2));
1743
1744 if (fls(batch) >= (PAGE_SHIFT + MAX_ORDER - 2))
1745 batch = PAGE_SHIFT + ((MAX_ORDER - 1 - PAGE_SHIFT)/2);
1746
1747 return batch; 1747 return batch;
1748} 1748}
1749 1749