Skip to content

Commit 0f04ab5

Browse files
hkamezawaLinus Torvalds
authored andcommitted
[PATCH] memory hotadd fixes: change find_next_system_ram's return value manner
find_next_system_ram() returns valid memory range which meets requested area, only used by memory-hot-add. This function always rewrite requested resource even if returned area is not fully fit in requested one. And sometimes the returnd resource is larger than requested area. This annoyes the caller. This patch changes the returned value to fit in requested area. 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>
1 parent 6f71271 commit 0f04ab5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kernel/resource.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,10 @@ int find_next_system_ram(struct resource *res)
261261
if (!p)
262262
return -1;
263263
/* copy data */
264-
res->start = p->start;
265-
res->end = p->end;
264+
if (res->start < p->start)
265+
res->start = p->start;
266+
if (res->end > p->end)
267+
res->end = p->end;
266268
return 0;
267269
}
268270
#endif

0 commit comments

Comments
 (0)