mm/hugetlb.c | 3 +++ 1 file changed, 3 insertions(+)
From: Li RongQing <lirongqing@baidu.com>
Optimize hugetlb_pages_alloc_boot() to return immediately when
max_huge_pages is 0, saving cycles when hugepages aren't configured
in the kernel command line.
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
mm/hugetlb.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 753f99b..514fab5 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3654,6 +3654,9 @@ static void __init hugetlb_hstate_alloc_pages(struct hstate *h)
return;
}
+ if (!h->max_huge_pages)
+ return;
+
/* do node specific alloc */
if (hugetlb_hstate_alloc_pages_specific_nodes(h))
return;
--
2.9.4
On 14.08.25 10:29, lirongqing wrote: > From: Li RongQing <lirongqing@baidu.com> > > Optimize hugetlb_pages_alloc_boot() to return immediately when > max_huge_pages is 0, saving cycles when hugepages aren't configured > in the kernel command line. Do we really care? -- Cheers David / dhildenb
> On 14.08.25 10:29, lirongqing wrote: > > From: Li RongQing <lirongqing@baidu.com> > > > > Optimize hugetlb_pages_alloc_boot() to return immediately when > > max_huge_pages is 0, saving cycles when hugepages aren't configured in > > the kernel command line. > > Do we really care? > I find this when I see the boot log, I think this log is unnecessary if user did not configure hugetlbfs in kernel cmdline kernel: HugeTLB: allocation took 0ms with hugepage_allocation_threads=32 Br -Li > -- > Cheers > > David / dhildenb
On 14.08.25 11:12, Li,Rongqing wrote: >> On 14.08.25 10:29, lirongqing wrote: >>> From: Li RongQing <lirongqing@baidu.com> >>> >>> Optimize hugetlb_pages_alloc_boot() to return immediately when >>> max_huge_pages is 0, saving cycles when hugepages aren't configured in >>> the kernel command line. >> >> Do we really care? >> > > I find this when I see the boot log, I think this log is unnecessary if user did not configure hugetlbfs in kernel cmdline > > kernel: HugeTLB: allocation took 0ms with hugepage_allocation_threads=32 That's valuable information to add to the patch description :) -- Cheers David / dhildenb
© 2016 - 2025 Red Hat, Inc.