Re: [PATCH] mm/hugetlb: avoid unnecessary hugetlb_acct_memory() call

From: David Hildenbrand
Date: Fri Jan 15 2021 - 03:49:18 EST


On 15.01.21 03:04, Miaohe Lin wrote:
> Hi:
>
> On 2021/1/15 3:16, Mike Kravetz wrote:
>> On 1/14/21 4:32 AM, David Hildenbrand wrote:
>>> On 14.01.21 12:31, Miaohe Lin wrote:
>>>> When gbl_reserve is 0, hugetlb_acct_memory() will do nothing except holding
>>>> and releasing hugetlb_lock.
>>>
>>> So, what's the deal then? Adding more code?
>>>
>>> If this is a performance improvement, we should spell it out. Otherwise
>>> I don't see a real benefit of this patch.
>>>
>>
>> Thanks for finding/noticing this.
>>
>> As David points out, the commit message should state that this is a
>> performance improvement. Mention that such a change avoids an unnecessary
>> hugetlb_lock lock/unlock cycle. You can also mention that this unnecessary
>> lock cycle is happening on 'most' hugetlb munmap operations.
>>
>
> My bad. I should spell this out explicitly. Many thanks for both of you.

With the "lock cycle is happening on 'most' hugetlb munmap operations"
part added

Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>

Thanks!

--
Thanks,

David / dhildenb