Skip to content

Commit

Permalink
memblock: don't silently align size in memblock_virt_alloc()
Browse files Browse the repository at this point in the history
In original __alloc_memory_core_early() for bootmem wrapper, we do not
align size silently.

We should not do that, as later free with old size will leave some range
not freed.

It's obvious that code is copied from memblock_base_nid(), and that code
is wrong for the same reason.

Also remove that in memblock_alloc_base.

Signed-off-by: Yinghai Lu <[email protected]>
Acked-by: Santosh Shilimkar <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Russell King <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Yinghai Lu authored and torvalds committed Jan 28, 2014
1 parent 4ce7a86 commit fb5bb60
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions mm/memblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,9 +984,6 @@ static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
if (!align)
align = SMP_CACHE_BYTES;

/* align @size to avoid excessive fragmentation on reserved array */
size = round_up(size, align);

found = memblock_find_in_range_node(size, align, 0, max_addr, nid);
if (found && !memblock_reserve(found, size))
return found;
Expand Down Expand Up @@ -1080,9 +1077,6 @@ static void * __init memblock_virt_alloc_internal(
if (!align)
align = SMP_CACHE_BYTES;

/* align @size to avoid excessive fragmentation on reserved array */
size = round_up(size, align);

again:
alloc = memblock_find_in_range_node(size, align, min_addr, max_addr,
nid);
Expand Down

0 comments on commit fb5bb60

Please sign in to comment.