* [patch] clamp batch size to (2^n)-1
@ 2005-04-09 14:03 Nick Piggin
0 siblings, 0 replies; only message in thread
From: Nick Piggin @ 2005-04-09 14:03 UTC (permalink / raw)
To: Jack Steiner, Linux Memory Management
[-- Attachment #1: Type: text/plain, Size: 355 bytes --]
Oh, this is the other thing.
I'm thinking it would be a good idea to get this into -mm ASAP,
even before you guys have fully tested it. Just to get the wheels
in motion early.
Yeah? Or did you have something else in mind?
(It is actually against the previous patchset, but obviously that
won't be merged before this patch).
--
SUSE Labs, Novell Inc.
[-- Attachment #2: pcp-modify-batch.patch --]
[-- Type: text/plain, Size: 922 bytes --]
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-04-09 14:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-09 14:03 [patch] clamp batch size to (2^n)-1 Nick Piggin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox