Thread (5 messages) 5 messages, 5 authors, 2021-11-30

Re: [BUG] hugetlbfs: Fix issue of preallocation of gigantic pages can't work

From: Maxim Levitsky <hidden>
Date: 2021-11-30 07:48:31
Also in: lkml

On Mon, 2021-11-29 at 21:38 +0800, Zhenguo Yao wrote:
quoted hunk ↗ jump to hunk
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.

Signed-off-by: Zhenguo Yao <redacted>
---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 60f9b6a9582e..6d1603387914 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -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!
Tested-by: Maxim Levitsky <redacted>

Best regards,
	Maxim Levitsky

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help