* [PATCH] mm/hugetlb: early exit from hugetlb_pages_alloc_boot() when max_huge_pages=0
@ 2025-08-14 8:29 lirongqing
2025-08-14 9:01 ` David Hildenbrand
0 siblings, 1 reply; 4+ messages in thread
From: lirongqing @ 2025-08-14 8:29 UTC (permalink / raw)
To: muchun.song, osalvador, david, akpm, linux-mm, linux-kernel; +Cc: Li RongQing
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/hugetlb: early exit from hugetlb_pages_alloc_boot() when max_huge_pages=0
2025-08-14 8:29 [PATCH] mm/hugetlb: early exit from hugetlb_pages_alloc_boot() when max_huge_pages=0 lirongqing
@ 2025-08-14 9:01 ` David Hildenbrand
2025-08-14 9:12 ` [外部邮件] " Li,Rongqing
0 siblings, 1 reply; 4+ messages in thread
From: David Hildenbrand @ 2025-08-14 9:01 UTC (permalink / raw)
To: lirongqing, muchun.song, osalvador, akpm, linux-mm, linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [外部邮件] Re: [PATCH] mm/hugetlb: early exit from hugetlb_pages_alloc_boot() when max_huge_pages=0
2025-08-14 9:01 ` David Hildenbrand
@ 2025-08-14 9:12 ` Li,Rongqing
2025-08-14 9:15 ` David Hildenbrand
0 siblings, 1 reply; 4+ messages in thread
From: Li,Rongqing @ 2025-08-14 9:12 UTC (permalink / raw)
To: David Hildenbrand, muchun.song@linux.dev, osalvador@suse.de,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [外部邮件] Re: [PATCH] mm/hugetlb: early exit from hugetlb_pages_alloc_boot() when max_huge_pages=0
2025-08-14 9:12 ` [外部邮件] " Li,Rongqing
@ 2025-08-14 9:15 ` David Hildenbrand
0 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2025-08-14 9:15 UTC (permalink / raw)
To: Li,Rongqing, muchun.song@linux.dev, osalvador@suse.de,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-14 9:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14 8:29 [PATCH] mm/hugetlb: early exit from hugetlb_pages_alloc_boot() when max_huge_pages=0 lirongqing
2025-08-14 9:01 ` David Hildenbrand
2025-08-14 9:12 ` [外部邮件] " Li,Rongqing
2025-08-14 9:15 ` David Hildenbrand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).