path: root/mm/sparse.c
diff options
authorYunfeng Ye <>2019-11-30 17:56:27 -0800
committerLinus Torvalds <>2019-12-01 12:59:08 -0800
commit0ac398b171aacd0f0c132d989ec4efb5de94f34a (patch)
treef5c500393edb2308a7cf8e5bff3b63ccb79d290b /mm/sparse.c
parent95830666be2aef81a2963135822ab92f4902a06b (diff)
mm: support memblock alloc on the exact node for sparse_buffer_init()
sparse_buffer_init() use memblock_alloc_try_nid_raw() to allocate memory for page management structure, if memory allocation fails from specified node, it will fall back to allocate from other nodes. Normally, the page management structure will not exceed 2% of the total memory, but a large continuous block of allocation is needed. In most cases, memory allocation from the specified node will succeed, but a node memory become highly fragmented will fail. we expect to allocate memory base section rather than by allocating a large block of memory from other NUMA nodes Add memblock_alloc_exact_nid_raw() for this situation, which allocate boot memory block on the exact node. If a large contiguous block memory allocate fail in sparse_buffer_init(), it will fall back to allocate small block memory base section. Link: Signed-off-by: Yunfeng Ye <> Reviewed-by: Mike Rapoport <> Cc: Wei Yang <> Cc: Oscar Salvador <> Cc: Dan Williams <> Cc: David Hildenbrand <> Cc: Qian Cai <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/sparse.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/sparse.c b/mm/sparse.c
index 8526d3bf1e4e..b20ab7cdac86 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -486,7 +486,7 @@ static void __init sparse_buffer_init(unsigned long size, int nid)
* and we want it to be properly aligned to the section size - this is
* especially the case for VMEMMAP which maps memmap to PMDs
- sparsemap_buf = memblock_alloc_try_nid_raw(size, section_map_size(),
+ sparsemap_buf = memblock_alloc_exact_nid_raw(size, section_map_size(),
sparsemap_buf_end = sparsemap_buf + size;