浏览代码

memblock: don't silently align size in memblock_virt_alloc()

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 <yinghai@kernel.org>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Yinghai Lu 12 年之前
父节点
当前提交
fb5bb60cd0
共有 1 个文件被更改,包括 0 次插入6 次删除
  1. 0 6
      mm/memblock.c

+ 0 - 6
mm/memblock.c

@@ -984,9 +984,6 @@ static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
 	if (!align)
 	if (!align)
 		align = SMP_CACHE_BYTES;
 		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);
 	found = memblock_find_in_range_node(size, align, 0, max_addr, nid);
 	if (found && !memblock_reserve(found, size))
 	if (found && !memblock_reserve(found, size))
 		return found;
 		return found;
@@ -1080,9 +1077,6 @@ static void * __init memblock_virt_alloc_internal(
 	if (!align)
 	if (!align)
 		align = SMP_CACHE_BYTES;
 		align = SMP_CACHE_BYTES;
 
 
-	/* align @size to avoid excessive fragmentation on reserved array */
-	size = round_up(size, align);
-
 again:
 again:
 	alloc = memblock_find_in_range_node(size, align, min_addr, max_addr,
 	alloc = memblock_find_in_range_node(size, align, min_addr, max_addr,
 					    nid);
 					    nid);