]> git.baikalelectronics.ru Git - kernel.git/commit
mm: sparse: fix usemap allocation above node descriptor section
authorYinghai Lu <yinghai@kernel.org>
Wed, 11 Jul 2012 21:02:53 +0000 (14:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Jul 2012 23:04:49 +0000 (16:04 -0700)
commit8300799f9342ed592b09791eb364c77b1cec84fe
tree74ac6a77d44e5ee0657456c1335ec74edd5c3d0e
parentd730467da36eeed6ded79542148924d8f074f5d2
mm: sparse: fix usemap allocation above node descriptor section

After commit bb7e6468ed6a ("bootmem/sparsemem: remove limit constraint
in alloc_bootmem_section"), usemap allocations may easily be placed
outside the optimal section that holds the node descriptor, even if
there is space available in that section.  This results in unnecessary
hotplug dependencies that need to have the node unplugged before the
section holding the usemap.

The reason is that the bootmem allocator doesn't guarantee a linear
search starting from the passed allocation goal but may start out at a
much higher address absent an upper limit.

Fix this by trying the allocation with the limit at the section end,
then retry without if that fails.  This keeps the fix from bb7e6468ed6a
of not panicking if the allocation does not fit in the section, but
still makes sure to try to stay within the section at first.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: <stable@vger.kernel.org> [3.3.x, 3.4.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/bootmem.h
mm/bootmem.c
mm/nobootmem.c
mm/sparse.c