提交 4738e1b9 编写于 作者: J Jan Beulich 提交者: Linus Torvalds

memory hotplug: fix updating of num_physpages for hot plugged memory

Sizing of memory allocations shouldn't depend on the number of physical
pages found in a system, as that generally includes (perhaps a huge amount
of) non-RAM pages.  The amount of what actually is usable as storage
should instead be used as a basis here.

In line with that, the memory hotplug code should update num_physpages in
a way that it retains its original (post-boot) meaning; in particular,
decreasing the value should at best be done with great care - this patch
doesn't try to ever decrease this value at all as it doesn't really seem
meaningful to do so.
Signed-off-by: NJan Beulich <jbeulich@novell.com>
Acked-by: NRusty Russell <rusty@rustcorp.com.au>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Badari Pulavarty <pbadari@us.ibm.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 78986a67
...@@ -339,8 +339,11 @@ EXPORT_SYMBOL_GPL(__remove_pages); ...@@ -339,8 +339,11 @@ EXPORT_SYMBOL_GPL(__remove_pages);
void online_page(struct page *page) void online_page(struct page *page)
{ {
unsigned long pfn = page_to_pfn(page);
totalram_pages++; totalram_pages++;
num_physpages++; if (pfn >= num_physpages)
num_physpages = pfn + 1;
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
if (PageHighMem(page)) if (PageHighMem(page))
...@@ -832,7 +835,6 @@ int offline_pages(unsigned long start_pfn, ...@@ -832,7 +835,6 @@ int offline_pages(unsigned long start_pfn,
zone->present_pages -= offlined_pages; zone->present_pages -= offlined_pages;
zone->zone_pgdat->node_present_pages -= offlined_pages; zone->zone_pgdat->node_present_pages -= offlined_pages;
totalram_pages -= offlined_pages; totalram_pages -= offlined_pages;
num_physpages -= offlined_pages;
setup_per_zone_wmarks(); setup_per_zone_wmarks();
calculate_zone_inactive_ratio(zone); calculate_zone_inactive_ratio(zone);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册