aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2009-09-21 20:01:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 10:17:25 -0400
commit112067f0905b2de862c607ee62411cf47d2fe5c4 (patch)
tree55575b100292b764f945e4d9395989e8a734f883 /mm
parent478b81fd84a299adb401dbbae296f3767e552999 (diff)
memory hotplug: update zone pcp at memory online
In my test, 128M memory is hot added, but zone's pcp batch is 0, which is an obvious error. When pages are onlined, zone pcp should be updated accordingly. [akpm@linux-foundation.org: fix warnings] Signed-off-by: Shaohua Li <shaohua.li@intel.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Christoph Lameter <cl@linux-foundation.org> Cc: Yakui Zhao <yakui.zhao@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memory_hotplug.c1
-rw-r--r--mm/page_alloc.c26
2 files changed, 27 insertions, 0 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index e4412a676c88..616236e6343f 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -422,6 +422,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
422 zone->present_pages += onlined_pages; 422 zone->present_pages += onlined_pages;
423 zone->zone_pgdat->node_present_pages += onlined_pages; 423 zone->zone_pgdat->node_present_pages += onlined_pages;
424 424
425 zone_pcp_update(zone);
425 setup_per_zone_wmarks(); 426 setup_per_zone_wmarks();
426 calculate_zone_inactive_ratio(zone); 427 calculate_zone_inactive_ratio(zone);
427 if (onlined_pages) { 428 if (onlined_pages) {
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f4e929e356db..1a3a893ef50e 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3142,6 +3142,32 @@ int zone_wait_table_init(struct zone *zone, unsigned long zone_size_pages)
3142 return 0; 3142 return 0;
3143} 3143}
3144 3144
3145static int __zone_pcp_update(void *data)
3146{
3147 struct zone *zone = data;
3148 int cpu;
3149 unsigned long batch = zone_batchsize(zone), flags;
3150
3151 for (cpu = 0; cpu < NR_CPUS; cpu++) {
3152 struct per_cpu_pageset *pset;
3153 struct per_cpu_pages *pcp;
3154
3155 pset = zone_pcp(zone, cpu);
3156 pcp = &pset->pcp;
3157
3158 local_irq_save(flags);
3159 free_pages_bulk(zone, pcp->count, &pcp->list, 0);
3160 setup_pageset(pset, batch);
3161 local_irq_restore(flags);
3162 }
3163 return 0;
3164}
3165
3166void zone_pcp_update(struct zone *zone)
3167{
3168 stop_machine(__zone_pcp_update, zone, NULL);
3169}
3170
3145static __meminit void zone_pcp_init(struct zone *zone) 3171static __meminit void zone_pcp_init(struct zone *zone)
3146{ 3172{
3147 int cpu; 3173 int cpu;