Skip to content

Commit 4178158

Browse files
ZhenguoYao1torvalds
authored andcommitted
hugetlbfs: fix issue of preallocation of gigantic pages can't work
Preallocation of gigantic pages can't work bacause of commit b538908 ("hugetlbfs: extend the definition of hugepages parameter to support node allocation"). When nid is NUMA_NO_NODE(-1), alloc_bootmem_huge_page will always return without doing allocation. Fix this by adding more check. Link: https://lkml.kernel.org/r/20211129133803.15653-1-yaozhenguo1@gmail.com Fixes: b538908 ("hugetlbfs: extend the definition of hugepages parameter to support node allocation") Signed-off-by: Zhenguo Yao <yaozhenguo1@gmail.com> Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com> Tested-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Muchun Song <songmuchun@bytedance.com> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent a7ebf56 commit 4178158

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mm/hugetlb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2973,7 +2973,7 @@ int __alloc_bootmem_huge_page(struct hstate *h, int nid)
29732973
struct huge_bootmem_page *m = NULL; /* initialize for clang */
29742974
int nr_nodes, node;
29752975

2976-
if (nid >= nr_online_nodes)
2976+
if (nid != NUMA_NO_NODE && nid >= nr_online_nodes)
29772977
return 0;
29782978
/* do node specific alloc */
29792979
if (nid != NUMA_NO_NODE) {

0 commit comments

Comments
 (0)