From: David Hildenbrand <david@redhat.com>
To: "Li,Rongqing" <lirongqing@baidu.com>,
"muchun.song@linux.dev" <muchun.song@linux.dev>,
"osalvador@suse.de" <osalvador@suse.de>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"giorgitchankvetadze1997@gmail.com"
<giorgitchankvetadze1997@gmail.com>
Cc: "Xu,Wenjie(ACG CCN)" <xuwenjie04@baidu.com>
Subject: Re: [PATCH] mm/hugetlb: two-phase hugepage allocation when reservation is high
Date: Wed, 27 Aug 2025 14:37:33 +0200 [thread overview]
Message-ID: <b276a150-92f3-408c-b146-7408b68ec778@redhat.com> (raw)
In-Reply-To: <73da268715754133b787f22e016a903c@baidu.com>
On 27.08.25 14:33, Li,Rongqing wrote:
>> Not sure if something like the following could fly:
>>
>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c index
>> 1f42186a85ea4..dfb4d717b8a02 100644
>> --- a/mm/hugetlb.c
>> +++ b/mm/hugetlb.c
>> @@ -3595,8 +3595,6 @@ static unsigned long __init
>> hugetlb_pages_alloc_boot(struct hstate *h)
>> unsigned long jiffies_end;
>>
>> job.thread_fn = hugetlb_pages_alloc_boot_node;
>> - job.start = 0;
>> - job.size = h->max_huge_pages;
>>
>> /*
>> * job.max_threads is 25% of the available cpu threads by default.
>> @@ -3620,10 +3618,24 @@ static unsigned long __init
>> hugetlb_pages_alloc_boot(struct hstate *h)
>> }
>>
>> job.max_threads = hugepage_allocation_threads;
>> - job.min_chunk = h->max_huge_pages /
>> hugepage_allocation_threads;
>>
>> jiffies_start = jiffies;
>> - padata_do_multithreaded(&job);
>> + /* TODO: comment why we retry and how it interacts with
>> vmemmap op. */
>> + while (h->nr_huge_pages != h->max_huge_pages) {
>> + unsigned long remaining = h->max_huge_pages -
>> + h->nr_huge_pages;
>> +
>> + job.start = h->nr_huge_pages;
>> + job.size = remaining;
>> + job.min_chunk = remaining /
>> hugepage_allocation_threads;
>> + padata_do_multithreaded(&job);
>> +
>> + if (hugetlb_vmemmap_optimizable(h))
>> + break;
>
> It should be:
> if (!hugetlb_vmemmap_optimizable(h))
> break;
Very right.
--
Cheers
David / dhildenb
next prev parent reply other threads:[~2025-08-27 12:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-27 12:33 Li,Rongqing
2025-08-27 12:37 ` David Hildenbrand [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-08-27 4:12 Li,Rongqing
2025-08-27 11:51 ` David Hildenbrand
2025-08-26 10:18 lirongqing
2025-08-26 13:25 ` David Hildenbrand
2025-08-22 11:28 lirongqing
2025-08-22 13:50 ` Giorgi Tchankvetadze
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b276a150-92f3-408c-b146-7408b68ec778@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=giorgitchankvetadze1997@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lirongqing@baidu.com \
--cc=muchun.song@linux.dev \
--cc=osalvador@suse.de \
--cc=xuwenjie04@baidu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox