Skip to content

Commit c3723ca

Browse files
heicarsttorvalds
authored andcommitted
memory hotplug: memmap_init_zone called twice
__add_zone calls memmap_init_zone twice if memory gets attached to an empty zone. Once via init_currently_empty_zone and once explictly right after that call. Looks like this is currently not a bug, however the call is superfluous and might lead to subtle bugs if memmap_init_zone gets changed. So make sure it is called only once. Cc: Yasunori Goto <y-goto@jp.fujitsu.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Dave Hansen <haveblue@us.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 3b7ec11 commit c3723ca

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

mm/memory_hotplug.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,9 @@ static int __add_zone(struct zone *zone, unsigned long phys_start_pfn)
167167
int zone_type;
168168

169169
zone_type = zone - pgdat->node_zones;
170-
if (!zone->wait_table) {
171-
int ret = 0;
172-
ret = init_currently_empty_zone(zone, phys_start_pfn,
173-
nr_pages, MEMMAP_HOTPLUG);
174-
if (ret < 0)
175-
return ret;
176-
}
170+
if (!zone->wait_table)
171+
return init_currently_empty_zone(zone, phys_start_pfn,
172+
nr_pages, MEMMAP_HOTPLUG);
177173
memmap_init_zone(nr_pages, nid, zone_type,
178174
phys_start_pfn, MEMMAP_HOTPLUG);
179175
return 0;

0 commit comments

Comments
 (0)