hugetlbfs: Fix issue of preallocation of gigantic pages can't work
Subsystems (2)
Preallocation of gigantic pages can't work bacause of commit:b5389086ad7b (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.
--- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/hugetlb.c +1 -1
@@ -2876,7 +2876,7 @@ int __alloc_bootmem_huge_page(struct hstate *h, int nid)struct huge_bootmem_page *m =NULL ;/* initialize for clang */ int nr_nodes, node; -if (nid >= nr_online_nodes) +if (nid !=NUMA_NO_NODE && nid >= nr_online_nodes)return 0 ;/* do node specific alloc */ if (nid !=NUMA_NO_NODE ) {
Signature · 1 line
2.27.0
Mike Kravetz
Reviewed-byQuoted 6 lines · Zhenguo Yao
Preallocation of gigantic pages can't work bacause of commit:b5389086ad7b (hugetlbfs: extend the definition of hugepages parameter to support node allocation). When nid is
NUMA_NO_NODE(-1),alloc_bootmem_huge_pagewill always return without doing allocation. Fix this by adding more check.Signed-off-by Zhenguo Yao <[email protected]>
Thank you,
Signature · 1 line
Mike Kravetz
Quoted 18 lines
--- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/hugetlb.c +1
-1@@ -2876,7 +2876,7 @@ int __alloc_bootmem_huge_page(struct hstate *h, int nid)struct huge_bootmem_page *m =NULL ;/* initialize for clang */ int nr_nodes, node; -if (nid >= nr_online_nodes) +if (nid !=NUMA_NO_NODE && nid >= nr_online_nodes)return 0 ;/* do node specific alloc */ if (nid !=NUMA_NO_NODE ) {
Baolin Wang
Reviewed-byHi,
Quoted 6 lines · Zhenguo Yao
Preallocation of gigantic pages can't work bacause of commit:b5389086ad7b (hugetlbfs: extend the definition of hugepages parameter to support node allocation). When nid is
NUMA_NO_NODE(-1),alloc_bootmem_huge_pagewill always return without doing allocation. Fix this by adding more check.Signed-off-by Zhenguo Yao <[email protected]>
You should add a fixes tag, otherwise LGTM.
Muchun Song
Reviewed-byQuoted 7 lines · Zhenguo Yao
Preallocation of gigantic pages can't work bacause of commit:b5389086ad7b (hugetlbfs: extend the definition of hugepages parameter to support node allocation). When nid is
NUMA_NO_NODE(-1),alloc_bootmem_huge_pagewill always return without doing allocation. Fix this by adding more check.Signed-off-by Zhenguo Yao <[email protected]>
Thanks.
Maxim Levitsky
Tested-byQuoted 15 lines · Zhenguo Yao
Preallocation of gigantic pages can't work bacause of commit:b5389086ad7b (hugetlbfs: extend the definition of hugepages parameter to support node allocation). When nid is
NUMA_NO_NODE(-1),alloc_bootmem_huge_pagewill always return without doing allocation. Fix this by adding more check.Signed-off-by Zhenguo Yao <[email protected]>--- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/hugetlb.c +0
-0
mm/hugetlb.c int __alloc_bootmem_huge_page(struct hstate *h, int nid) · line 2882
Quoted 8 lines
mm/hugetlb.c +1
-1@@ -2876,7 +2876,7 @@ int __alloc_bootmem_huge_page(struct hstate *h, int nid)struct huge_bootmem_page *m =NULL ;/* initialize for clang */ int nr_nodes, node; -if (nid >= nr_online_nodes) +if (nid !=NUMA_NO_NODE && nid >= nr_online_nodes)return 0 ;/* do node specific alloc */ if (nid !=NUMA_NO_NODE ) {
Tested, works fine.
Thanks!
Best regards,
Maxim Levitsky