public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] memory hotadd fixes [3/5] find_next_system_ram catch range fix
@ 2006-08-03  3:34 KAMEZAWA Hiroyuki
  2006-08-04  0:08 ` keith mannthey
  0 siblings, 1 reply; 2+ messages in thread
From: KAMEZAWA Hiroyuki @ 2006-08-03  3:34 UTC (permalink / raw)
  To: LKML; +Cc: LHMS, kmannth@us.ibm.com, y-goto@jp.fujitsu.com, Andrew Morton

 
find_next_system_ram() is used to find available memory resource
at onlining newly added memory.
This patch fixes following problem.

find_next_system_ram() cannot catch this case.

Resource:      (start)-------------(end)
Section :                (start)-------------(end)


Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

 kernel/resource.c   |    3 ++-
 mm/memory_hotplug.c |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.18-rc3/kernel/resource.c
===================================================================
--- linux-2.6.18-rc3.orig/kernel/resource.c	2006-08-01 16:38:45.000000000 +0900
+++ linux-2.6.18-rc3/kernel/resource.c	2006-08-01 16:38:56.000000000 +0900
@@ -244,6 +244,7 @@
 
 	start = res->start;
 	end = res->end;
+	BUG_ON(start >= end);
 
 	read_lock(&resource_lock);
 	for (p = iomem_resource.child; p ; p = p->sibling) {
@@ -254,7 +255,7 @@
 			p = NULL;
 			break;
 		}
-		if (p->start >= start)
+		if ((p->end >= start) && (p->start < end))
 			break;
 	}
 	read_unlock(&resource_lock);
Index: linux-2.6.18-rc3/mm/memory_hotplug.c
===================================================================
--- linux-2.6.18-rc3.orig/mm/memory_hotplug.c	2006-08-01 16:38:19.000000000 +0900
+++ linux-2.6.18-rc3/mm/memory_hotplug.c	2006-08-01 16:38:56.000000000 +0900
@@ -163,7 +163,7 @@
 	res.flags = IORESOURCE_MEM; /* we just need system ram */
 	section_end = res.end;
 
-	while (find_next_system_ram(&res) >= 0) {
+	while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) {
 		start_pfn = (unsigned long)(res.start >> PAGE_SHIFT);
 		nr_pages = (unsigned long)
                            ((res.end + 1 - res.start) >> PAGE_SHIFT);


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

* Re: [PATCH] memory hotadd fixes [3/5] find_next_system_ram catch range fix
  2006-08-03  3:34 [PATCH] memory hotadd fixes [3/5] find_next_system_ram catch range fix KAMEZAWA Hiroyuki
@ 2006-08-04  0:08 ` keith mannthey
  0 siblings, 0 replies; 2+ messages in thread
From: keith mannthey @ 2006-08-04  0:08 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: lkml, lhms-devel, y-goto@jp.fujitsu.com, Andrew Morton

On Thu, 2006-08-03 at 12:34 +0900, KAMEZAWA Hiroyuki wrote:
>  find_next_system_ram() is used to find available memory resource
> at onlining newly added memory.
> This patch fixes following problem.
> 
> find_next_system_ram() cannot catch this case.
> 
> Resource:      (start)-------------(end)
> Section :                (start)-------------(end)
> 
> 
> Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
>  kernel/resource.c   |    3 ++-
>  mm/memory_hotplug.c |    2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6.18-rc3/kernel/resource.c
> ===================================================================
> --- linux-2.6.18-rc3.orig/kernel/resource.c	2006-08-01 16:38:45.000000000 +0900
> +++ linux-2.6.18-rc3/kernel/resource.c	2006-08-01 16:38:56.000000000 +0900
> @@ -244,6 +244,7 @@
>  
>  	start = res->start;
>  	end = res->end;
> +	BUG_ON(start >= end);

BUG_ON seems a little strong for bad arguments to the function but I am
ok with it. 

Thanks,
 Keith 


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

end of thread, other threads:[~2006-08-04  0:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-03  3:34 [PATCH] memory hotadd fixes [3/5] find_next_system_ram catch range fix KAMEZAWA Hiroyuki
2006-08-04  0:08 ` keith mannthey

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