Subject: page allocator: Use only a single per_cpu_pageset for bootstrapping We bring up processors one by one. If there is no concurrency then we can get away with only a single per_cpu_pageset for bootstrap. The bootstrap pageset will be left in its initial condition once the bootstrap of a single processor has finished. The existing per cpu pagesets are already used for multiple zones. They are already used in this fashion. Signed-off-by: Christoph Lameter --- mm/page_alloc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) Index: linux-2.6/mm/page_alloc.c =================================================================== --- linux-2.6.orig/mm/page_alloc.c 2008-04-28 14:42:28.372400669 -0700 +++ linux-2.6/mm/page_alloc.c 2008-04-28 14:55:08.443189768 -0700 @@ -2655,11 +2655,24 @@ static void setup_pagelist_highmark(stru * unused processors and/or zones. They do play a role for bootstrapping * hotplugged processors. * + * The use of the pageset assumes that only one processor at a time + * will use the pageset for bootstrapping. This means that multiple + * processors cannot be simultenaously be bootstrapped. The boot + * pageset is configured in such a way that it does not queue pages but + * directly call in to the slow patch for both allocate and free. + * * zoneinfo_show() and maybe other functions do * not check if the processor is online before following the pageset pointer. * Other parts of the kernel may not check if the zone is available. */ -static struct per_cpu_pageset boot_pageset[NR_CPUS]; +static struct per_cpu_pageset boot_pageset = { { + .count = 0, + .high = 0, + .batch = 1, + .list = LIST_HEAD_INIT(boot_pageset.pcp.list) + }, + .stat_threshold = 1 +}; /* * Dynamically allocate memory for the @@ -2710,7 +2723,7 @@ static inline void free_zone_pagesets(in struct per_cpu_pageset *pset = zone_pcp(zone, cpu); /* Free per_cpu_pageset if it is slab allocated */ - if (pset != &boot_pageset[cpu]) + if (pset != &boot_pageset) kfree(pset); zone_pcp(zone, cpu) = NULL; } @@ -2810,8 +2823,7 @@ static __meminit void zone_pcp_init(stru for (cpu = 0; cpu < NR_CPUS; cpu++) { #ifdef CONFIG_NUMA /* Early boot. Slab allocator not functional yet */ - zone_pcp(zone, cpu) = &boot_pageset[cpu]; - setup_pageset(&boot_pageset[cpu],0); + zone_pcp(zone, cpu) = &boot_pageset; #else setup_pageset(zone_pcp(zone,cpu), batch); #endif