Commit 25a6df95 authored by Yasunori Goto's avatar Yasunori Goto Committed by Linus Torvalds

[PATCH] spanned_pages is not updated at a case of memory hot-add

From: Yasunori Goto <y-goto@jp.fujitsu.com>

If hot-added memory's address is smaller than old area, spanned_pages will
not be updated.  It must be fixed.

example) Old zone_start_pfn = 0x60000, and spanned_pages = 0x10000
         Added new memory's start_pfn = 0x50000, and end_pfn = 0x60000

  new spanned_pages will be still 0x10000 by old code.
  (It should be updated to 0x20000.) Because old_zone_end_pfn will be
  0x70000, and end_pfn smaller than it. So, spanned_pages will not be
  updated.

In current code, spanned_pages is updated only when end_pfn is updated.
But, it should be updated by subtraction between bigger end_pfn and new
zone_start_pfn.
Signed-off-by: default avatarYasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: default avatarDave Hansen <haveblue@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 308af929
...@@ -91,8 +91,8 @@ static void grow_zone_span(struct zone *zone, ...@@ -91,8 +91,8 @@ static void grow_zone_span(struct zone *zone,
if (start_pfn < zone->zone_start_pfn) if (start_pfn < zone->zone_start_pfn)
zone->zone_start_pfn = start_pfn; zone->zone_start_pfn = start_pfn;
if (end_pfn > old_zone_end_pfn) zone->spanned_pages = max(old_zone_end_pfn, end_pfn) -
zone->spanned_pages = end_pfn - zone->zone_start_pfn; zone->zone_start_pfn;
zone_span_writeunlock(zone); zone_span_writeunlock(zone);
} }
...@@ -106,8 +106,8 @@ static void grow_pgdat_span(struct pglist_data *pgdat, ...@@ -106,8 +106,8 @@ static void grow_pgdat_span(struct pglist_data *pgdat,
if (start_pfn < pgdat->node_start_pfn) if (start_pfn < pgdat->node_start_pfn)
pgdat->node_start_pfn = start_pfn; pgdat->node_start_pfn = start_pfn;
if (end_pfn > old_pgdat_end_pfn) pgdat->node_spanned_pages = max(old_pgdat_end_pfn, end_pfn) -
pgdat->node_spanned_pages = end_pfn - pgdat->node_start_pfn; pgdat->node_start_pfn;
} }
int online_pages(unsigned long pfn, unsigned long nr_pages) int online_pages(unsigned long pfn, unsigned long nr_pages)
......
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