[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <354da702-ae1f-d884-3cc4-b8cde3ae9757@linux.alibaba.com>
Date: Sat, 17 Sep 2022 09:17:52 +0800
From: haoxin <xhao@...ux.alibaba.com>
To: Mike Kravetz <mike.kravetz@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: songmuchun@...edance.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] mm/hugetlb: add is_resv_equal_free() func
在 2022/9/17 上午5:09, Mike Kravetz 写道:
> On 09/16/22 13:12, Andrew Morton wrote:
>> On Fri, 16 Sep 2022 14:41:27 +0800 Xin Hao <xhao@...ux.alibaba.com> wrote:
>>
>>> In hugetlb.c file, there are several places to compare the values of
>>> 'h->free_huge_pages' and 'h->resv_huge_pages', it looks a bit messy, so
>>> there add a new is_resv_equal_free() func to do these.
>>>
>>> ...
>>>
>>> --- a/mm/hugetlb.c
>>> +++ b/mm/hugetlb.c
>>> @@ -1191,6 +1191,11 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
>>> return NULL;
>>> }
>>>
>>> +static inline bool is_resv_equal_free(struct hstate *h)
>> I'm not sure that's a well chosen name. A better name would reflect
>> the *meaning* of free_huge_pages being equal to resv_huge_pages. Maybe
>> something like reserves_exhausted()?
> How about calling it free_non_reserved_huge_pages() and returning the actual
> value (h->free_huge_pages - h->resv_huge_pages)?
>
> Perhaps available_huge_pages()?
Ok, I am going to use available_huge_pages() in the patch v3, thanks.
> It could then be used in at least one other place
> - if (h->free_huge_pages - h->resv_huge_pages > 0)
>
>> This would all be clearer if we'd bothered to document the fields of
>> struct hstate :(
> Agree, and discussed elsewhwere some may even be able to be eliminated. I can
> add that to my todo list.
Powered by blists - more mailing lists