summaryrefslogtreecommitdiff
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2005-12-05 11:50:17 -0800
committerTony Luck <tony.luck@intel.com>2005-12-05 11:50:17 -0800
commit3e356b2660eda9da7776144cbc0a038c93dcb335 (patch)
tree378a38636f6b67a5f092a73850223d11cdfb5ff5 /mm/page_alloc.c
parent05f70395c642bed0300bc1955bfa8c0f93de2bc2 (diff)
parente4f5c82a92c2a546a16af1614114eec19120e40a (diff)
Auto-update from upstream
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b257720edfc8..3b21a13d841c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1772,16 +1772,16 @@ static int __devinit zone_batchsize(struct zone *zone)
batch = 1;
/*
- * We will be trying to allcoate bigger chunks of contiguous
- * memory of the order of fls(batch). This should result in
- * better cache coloring.
+ * 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.
*
- * A sanity check also to ensure that batch is still in limits.
+ * 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));
-
- if (fls(batch) >= (PAGE_SHIFT + MAX_ORDER - 2))
- batch = PAGE_SHIFT + ((MAX_ORDER - 1 - PAGE_SHIFT)/2);
+ batch = (1 << (fls(batch + batch/2)-1)) - 1;
return batch;
}