Commit 319774e2 authored by Wu Fengguang's avatar Wu Fengguang Committed by Linus Torvalds

mem-hotplug: separate setup_per_cpu_pageset() into separate functions

No behavior change here.

Move some of setup_per_cpu_pageset() code into a new function
setup_zone_pageset() that will be useful for memory hotplug.
Signed-off-by: default avatarWu Fengguang <fengguang.wu@intel.com>
Signed-off-by: default avatarHaicheng Li <haicheng.li@linux.intel.com>
Reviewed-by: default avatarAndi Kleen <andi.kleen@intel.com>
Reviewed-by: default avatarChristoph Lameter <cl@linux-foundation.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0faa5638
...@@ -3292,31 +3292,34 @@ static void setup_pagelist_highmark(struct per_cpu_pageset *p, ...@@ -3292,31 +3292,34 @@ static void setup_pagelist_highmark(struct per_cpu_pageset *p,
pcp->batch = PAGE_SHIFT * 8; pcp->batch = PAGE_SHIFT * 8;
} }
static __meminit void setup_zone_pageset(struct zone *zone)
{
int cpu;
zone->pageset = alloc_percpu(struct per_cpu_pageset);
for_each_possible_cpu(cpu) {
struct per_cpu_pageset *pcp = per_cpu_ptr(zone->pageset, cpu);
setup_pageset(pcp, zone_batchsize(zone));
if (percpu_pagelist_fraction)
setup_pagelist_highmark(pcp,
(zone->present_pages /
percpu_pagelist_fraction));
}
}
/* /*
* Allocate per cpu pagesets and initialize them. * Allocate per cpu pagesets and initialize them.
* Before this call only boot pagesets were available. * Before this call only boot pagesets were available.
* Boot pagesets will no longer be used by this processorr
* after setup_per_cpu_pageset().
*/ */
void __init setup_per_cpu_pageset(void) void __init setup_per_cpu_pageset(void)
{ {
struct zone *zone; struct zone *zone;
int cpu;
for_each_populated_zone(zone) { for_each_populated_zone(zone)
zone->pageset = alloc_percpu(struct per_cpu_pageset); setup_zone_pageset(zone);
for_each_possible_cpu(cpu) {
struct per_cpu_pageset *pcp = per_cpu_ptr(zone->pageset, cpu);
setup_pageset(pcp, zone_batchsize(zone));
if (percpu_pagelist_fraction)
setup_pagelist_highmark(pcp,
(zone->present_pages /
percpu_pagelist_fraction));
}
}
} }
static noinline __init_refok static noinline __init_refok
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment