linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memory hotplug: memmap_init_zone called twice., [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

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;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] memory hotplug: memmap_init_zone called twice.
  2008-05-09  6:04 [PATCH] memory hotplug: memmap_init_zone called twice., [PATCH] memory hotplug: memmap_init_zone called twice Heiko Carstens
@ 2008-05-09  6:25 ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 2+ messages in thread
From: KAMEZAWA Hiroyuki @ 2008-05-09  6:25 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Andrew Morton, Yasunori Goto, Dave Hansen, Gerald Schaefer,
	linux-kernel, linux-mm

On Fri, 9 May 2008 08:04:25 +0200
Heiko Carstens <heiko.carstens@de.ibm.com> wrote:

> 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.
> 
seems reasonable. Thank you!

Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2008-05-09  6:25 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., [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;
as well as URLs for NNTP newsgroup(s).