Commit 13466c84 authored by Yasunori Goto's avatar Yasunori Goto Committed by Linus Torvalds

memory hotplug: fix unnecessary calling of init_currenty_empty_zone()

zone->present_pages is updated in online_pages().  But, __add_zone() can be
called twice or more before calling online_pages().  So,
init_currenty_empty_zone() can be called unnecessary times.  It is cause of
memory leak of zone's wait_table.
Signed-off-by: default avatarYasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6cd8fa87
...@@ -65,7 +65,7 @@ static int __add_zone(struct zone *zone, unsigned long phys_start_pfn) ...@@ -65,7 +65,7 @@ static int __add_zone(struct zone *zone, unsigned long phys_start_pfn)
int zone_type; int zone_type;
zone_type = zone - pgdat->node_zones; zone_type = zone - pgdat->node_zones;
if (!populated_zone(zone)) { if (!zone->wait_table) {
int ret = 0; int ret = 0;
ret = init_currently_empty_zone(zone, phys_start_pfn, ret = init_currently_empty_zone(zone, phys_start_pfn,
nr_pages, MEMMAP_HOTPLUG); nr_pages, MEMMAP_HOTPLUG);
......
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