[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <83e5f2a0-bf92-ab42-c5ff-52a07eab9ee8@oracle.com>
Date: Thu, 8 Apr 2021 21:37:46 -0700
From: Mike Kravetz <mike.kravetz@...cle.com>
To: Miaohe Lin <linmiaohe@...wei.com>, akpm@...ux-foundation.org
Cc: n-horiguchi@...jp.nec.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH 3/4] mm/hugeltb: fix potential wrong gbl_reserve value for
hugetlb_acct_memory()
On 4/8/21 8:01 PM, Miaohe Lin wrote:
> On 2021/4/9 6:53, Mike Kravetz wrote:
>>
>> Yes, add a comment to hugetlb_unreserve_pages saying that !resv_map
>> implies freed == 0.
>>
>
> Sounds good!
>
>> It would also be helpful to check for (chg - freed) == 0 and skip the
>> calls to hugepage_subpool_put_pages() and hugetlb_acct_memory(). Both
>> of those routines may perform an unnecessary lock/unlock cycle in this
>> case.
>>
>> A simple
>> if (chg == free)
>> return 0;
>> before the call to hugepage_subpool_put_pages would work.
>
> This may not be really helpful because hugepage_subpool_put_pages() and hugetlb_acct_memory()
> both would handle delta == 0 case without unnecessary lock/unlock cycle.
> Does this make sense for you? If so, I will prepare v2 with the changes to add a comment
> to hugetlb_unreserve_pages() __without__ the check for (chg - freed) == 0.
Sorry, I forgot about the recent changes to check for delta == 0.
No need for the check here, just the comment.
--
Mike Kravetz
Powered by blists - more mailing lists