mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] memory hotplug: memmap_init_zone called twice.
@ 2008-05-09  6:04 Heiko Carstens
  2008-05-09  6:25 ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 2+ messages in thread
From: Heiko Carstens @ 2008-05-09  6:04 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Yasunori Goto, KAMEZAWA Hiroyuki, Dave Hansen, Gerald Schaefer,
	linux-kernel, linux-mm

Subject: [PATCH] memory hotplug: memmap_init_zone called twice.

From: Heiko Carstens <heiko.carstens@de.ibm.com>

__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>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 mm/memory_hotplug.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Index: linux-2.6/mm/memory_hotplug.c
===================================================================
--- linux-2.6.orig/mm/memory_hotplug.c
+++ linux-2.6/mm/memory_hotplug.c
@@ -167,13 +167,9 @@ static int __add_zone(struct zone *zone,
 	int zone_type;
 
 	zone_type = zone - pgdat->node_zones;
-	if (!zone->wait_table) {
-		int ret = 0;
-		ret = init_currently_empty_zone(zone, phys_start_pfn,
-						nr_pages, MEMMAP_HOTPLUG);
-		if (ret < 0)
-			return ret;
-	}
+	if (!zone->wait_table)
+		return init_currently_empty_zone(zone, phys_start_pfn,
+						 nr_pages, MEMMAP_HOTPLUG);
 	memmap_init_zone(nr_pages, nid, zone_type,
 			 phys_start_pfn, MEMMAP_HOTPLUG);
 	return 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-09  6:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-09  6:04 [PATCH] memory hotplug: memmap_init_zone called twice Heiko Carstens
2008-05-09  6:25 ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®