[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fd43393e-b4db-4a12-84ee-0f045071c119@linux.dev>
Date: Thu, 11 Jan 2024 11:30:52 +0800
From: Gang Li <gang.li@...ux.dev>
To: Muchun Song <muchun.song@...ux.dev>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
ligang.bdlg@...edance.com, David Hildenbrand <david@...hat.com>,
David Rientjes <rientjes@...gle.com>, Mike Kravetz
<mike.kravetz@...cle.com>, Andrew Morton <akpm@...ux-foundation.org>,
Tim Chen <tim.c.chen@...ux.intel.com>
Subject: Re: [PATCH v3 1/7] hugetlb: code clean for hugetlb_hstate_alloc_pages
On 2024/1/10 18:19, Muchun Song wrote:
>
>
> On 2024/1/2 21:12, Gang Li wrote:
>> The readability of `hugetlb_hstate_alloc_pages` is poor. By cleaning the
>> code, its readability can be improved, facilitating future modifications.
>>
>> This patch extracts two functions to reduce the complexity of
>> `hugetlb_hstate_alloc_pages` and has no functional changes.
>>
>> - hugetlb_hstate_alloc_pages_node_specific() to handle iterates through
>> each online node and performs allocation if necessary.
>> - hugetlb_hstate_alloc_pages_report() report error during allocation.
>> And the value of h->max_huge_pages is updated accordingly.
>>
>> Signed-off-by: Gang Li <gang.li@...ux.dev>
>> ---
>> mm/hugetlb.c | 46 +++++++++++++++++++++++++++++-----------------
>> 1 file changed, 29 insertions(+), 17 deletions(-)
>>
>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
>> index ed1581b670d42..2606135ec55e6 100644
>> --- a/mm/hugetlb.c
>> +++ b/mm/hugetlb.c
>> @@ -3482,6 +3482,33 @@ static void __init
>> hugetlb_hstate_alloc_pages_onenode(struct hstate *h, int nid)
>> h->max_huge_pages_node[nid] = i;
>> }
>> +static bool __init hugetlb_hstate_alloc_pages_node_specific(struct
>> hstate *h)
>
> I'd like to rename this to hugetlb_hstate_alloc_pages_specific_nodes.
>
> Otherwise, LGTM.
>
> Reviewed-by: Muchun Song <muchun.song@...ux.dev>
>
Thanks! I will adjust it in the next version.
Powered by blists - more mailing lists