Commit 847854f5 authored by Tejun Heo's avatar Tejun Heo Committed by Ingo Molnar
Browse files

memblock: Fix size aligning of memblock_alloc_base_nid()

memblock allocator aligns @size to @align to reduce the amount
of fragmentation.  Commit:


 ("memblock: Reimplement memblock allocation using reverse free area iterator")

Broke it by incorrectly relocating @size aligning to
memblock_find_in_range_node().  As the aligned size is not
propagated back to memblock_alloc_base_nid(), the actually
reserved size isn't aligned.

While this increases memory use for memblock reserved array,
this shouldn't cause any critical failure; however, it seems
that the size aligning was hiding a use-beyond-allocation bug in
sparc64 and losing the aligning causes boot failure.

The underlying problem is currently being debugged but this is a
proper fix in itself, it's already pretty late in -rc cycle for
boot failures and reverting the change for debugging isn't
difficult. Restore the size aligning moving it to

Reported-by: default avatarMeelis Roos <>
Signed-off-by: default avatarTejun Heo <>
Cc: David S. Miller <>
Cc: Grant Likely <>
Cc: Rob Herring <>
Cc: Linus Torvalds <>
Cc: Andrew Morton <>

Signed-off-by: default avatarIngo Molnar <>
LKML-Reference: <>
parent 88ebdda6
......@@ -99,9 +99,6 @@ phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t start,
phys_addr_t this_start, this_end, cand;
u64 i;
/* align @size to avoid excessive fragmentation on reserved array */
size = round_up(size, align);
/* pump up @end */
end = memblock.current_limit;
......@@ -731,6 +728,9 @@ static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
phys_addr_t found;
/* align @size to avoid excessive fragmentation on reserved array */
size = round_up(size, align);
found = memblock_find_in_range_node(0, max_addr, size, align, nid);
if (found && !memblock_reserve(found, size))
return found;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment