[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b276a150-92f3-408c-b146-7408b68ec778@redhat.com>
Date: Wed, 27 Aug 2025 14:37:33 +0200
From: David Hildenbrand <david@...hat.com>
To: "Li,Rongqing" <lirongqing@...du.com>,
"muchun.song@...ux.dev" <muchun.song@...ux.dev>,
"osalvador@...e.de" <osalvador@...e.de>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"giorgitchankvetadze1997@...il.com" <giorgitchankvetadze1997@...il.com>
Cc: "Xu,Wenjie(ACG CCN)" <xuwenjie04@...du.com>
Subject: Re: [PATCH] mm/hugetlb: two-phase hugepage allocation when
reservation is high
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
Powered by blists - more mailing lists