OSDN Git Service

memblock: Fix alloc failure due to dumb underflow protection in memblock_find_in_rang...
authorTejun Heo <tj@kernel.org>
Fri, 13 Jan 2012 18:14:12 +0000 (10:14 -0800)
committerIngo Molnar <mingo@elte.hu>
Mon, 16 Jan 2012 07:38:06 +0000 (08:38 +0100)
commit5d53cb27d849c899136c048ec84c940ac449494b
tree66c78c014a06641245fa3cd219afabdc7afdf427
parentedf7c8148ec40c0fd27c0ef3f688defcc65e3913
memblock: Fix alloc failure due to dumb underflow protection in memblock_find_in_range_node()

7bd0b0f0da ("memblock: Reimplement memblock allocation using
reverse free area iterator") implemented a simple top-down
allocator using a reverse memblock iterator.  To avoid underflow
in the allocator loop, it simply raised the lower boundary to
the requested size under the assumption that requested size
would be far smaller than available memblocks.

This causes early page table allocation failure under certain
configurations in Xen.  Fix it by checking for underflow directly
instead of bumping up lower bound.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: rjw@sisk.pl
Cc: xen-devel@lists.xensource.com
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20120113181412.GA11112@google.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
mm/memblock.c