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/[email protected] Fixes: b538908 ("hugetlbfs: extend the definition of hugepages parameter to support node allocation") Signed-off-by: Zhenguo Yao <[email protected]> Reviewed-by: Mike Kravetz <[email protected]> Tested-by: Maxim Levitsky <[email protected]> Reviewed-by: Muchun Song <[email protected]> Reviewed-by: Baolin Wang <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent a7ebf56 commit 4178158

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)