diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2010-05-24 17:32:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-25 11:07:01 -0400 |
commit | 319774e25fa4b7641bdc3b0a464dd84e62103347 (patch) | |
tree | 6865aee1b58fff5d7042fbdcb989ee7751660bcc | |
parent | 0faa56389c793cda7f967117415717bbab24fe4e (diff) |
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: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Reviewed-by: Andi Kleen <andi.kleen@intel.com>
Reviewed-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/page_alloc.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8f4f27841b71..595d0ac211e2 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3292,31 +3292,34 @@ static void setup_pagelist_highmark(struct per_cpu_pageset *p, | |||
3292 | pcp->batch = PAGE_SHIFT * 8; | 3292 | pcp->batch = PAGE_SHIFT * 8; |
3293 | } | 3293 | } |
3294 | 3294 | ||
3295 | static __meminit void setup_zone_pageset(struct zone *zone) | ||
3296 | { | ||
3297 | int cpu; | ||
3298 | |||
3299 | zone->pageset = alloc_percpu(struct per_cpu_pageset); | ||
3300 | |||
3301 | for_each_possible_cpu(cpu) { | ||
3302 | struct per_cpu_pageset *pcp = per_cpu_ptr(zone->pageset, cpu); | ||
3303 | |||
3304 | setup_pageset(pcp, zone_batchsize(zone)); | ||
3305 | |||
3306 | if (percpu_pagelist_fraction) | ||
3307 | setup_pagelist_highmark(pcp, | ||
3308 | (zone->present_pages / | ||
3309 | percpu_pagelist_fraction)); | ||
3310 | } | ||
3311 | } | ||
3312 | |||
3295 | /* | 3313 | /* |
3296 | * Allocate per cpu pagesets and initialize them. | 3314 | * Allocate per cpu pagesets and initialize them. |
3297 | * Before this call only boot pagesets were available. | 3315 | * Before this call only boot pagesets were available. |
3298 | * Boot pagesets will no longer be used by this processorr | ||
3299 | * after setup_per_cpu_pageset(). | ||
3300 | */ | 3316 | */ |
3301 | void __init setup_per_cpu_pageset(void) | 3317 | void __init setup_per_cpu_pageset(void) |
3302 | { | 3318 | { |
3303 | struct zone *zone; | 3319 | struct zone *zone; |
3304 | int cpu; | ||
3305 | 3320 | ||
3306 | for_each_populated_zone(zone) { | 3321 | for_each_populated_zone(zone) |
3307 | zone->pageset = alloc_percpu(struct per_cpu_pageset); | 3322 | setup_zone_pageset(zone); |
3308 | |||
3309 | for_each_possible_cpu(cpu) { | ||
3310 | struct per_cpu_pageset *pcp = per_cpu_ptr(zone->pageset, cpu); | ||
3311 | |||
3312 | setup_pageset(pcp, zone_batchsize(zone)); | ||
3313 | |||
3314 | if (percpu_pagelist_fraction) | ||
3315 | setup_pagelist_highmark(pcp, | ||
3316 | (zone->present_pages / | ||
3317 | percpu_pagelist_fraction)); | ||
3318 | } | ||
3319 | } | ||
3320 | } | 3323 | } |
3321 | 3324 | ||
3322 | static noinline __init_refok | 3325 | static noinline __init_refok |