Commit 4027149a authored by Baoquan He's avatar Baoquan He Committed by Linus Torvalds
Browse files

mm/sparse.c: allocate memmap preferring the given node

When allocating memmap for hot added memory with the classic sparse, the
specified 'nid' is ignored in populate_section_memmap().

While in allocating memmap for the classic sparse during boot, the node
given by 'nid' is preferred.  And VMEMMAP prefers the node of 'nid' in
both boot stage and memory hot adding.  So seems no reason to not respect
the node of 'nid' for the classic sparse when hot adding memory.

Use kvmalloc_node instead to use the passed in 'nid'.
Signed-off-by: default avatarBaoquan He <>
Signed-off-by: default avatarAndrew Morton <>
Reviewed-by: default avatarMatthew Wilcox (Oracle) <>
Reviewed-by: default avatarDavid Hildenbrand <>
Reviewed-by: default avatarWei Yang <>
Acked-by: default avatarMichal Hocko <>
Acked-by: default avatarPankaj Gupta <>

Signed-off-by: default avatarLinus Torvalds <>
parent 3af776f6
......@@ -664,8 +664,8 @@ static void free_map_bootmem(struct page *memmap)
struct page * __meminit populate_section_memmap(unsigned long pfn,
unsigned long nr_pages, int nid, struct vmem_altmap *altmap)
return kvmalloc(array_size(sizeof(struct page),
return kvmalloc_node(array_size(sizeof(struct page),
static void depopulate_section_memmap(unsigned long pfn, unsigned long nr_pages,
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