Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] memory hotadd fixes: find_next_system_ram catch range fix

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>
Cc: Keith Mannthey <kmannth@gmail.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

KAMEZAWA Hiroyuki and committed by
Linus Torvalds
58c1b5b0 0f04ab5e

+3 -2
+2 -1
kernel/resource.c
··· 244 244 245 245 start = res->start; 246 246 end = res->end; 247 + BUG_ON(start >= end); 247 248 248 249 read_lock(&resource_lock); 249 250 for (p = iomem_resource.child; p ; p = p->sibling) { ··· 255 254 p = NULL; 256 255 break; 257 256 } 258 - if (p->start >= start) 257 + if ((p->end >= start) && (p->start < end)) 259 258 break; 260 259 } 261 260 read_unlock(&resource_lock);
+1 -1
mm/memory_hotplug.c
··· 163 163 res.flags = IORESOURCE_MEM; /* we just need system ram */ 164 164 section_end = res.end; 165 165 166 - while (find_next_system_ram(&res) >= 0) { 166 + while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) { 167 167 start_pfn = (unsigned long)(res.start >> PAGE_SHIFT); 168 168 nr_pages = (unsigned long) 169 169 ((res.end + 1 - res.start) >> PAGE_SHIFT);