[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c15bfa20-2113-4299-98bf-1865b6b535ef@126.com>
Date: Thu, 5 Jun 2025 08:44:09 +0800
From: Ge Yang <yangge1116@....com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, 21cnbao@...il.com,
david@...hat.com, baolin.wang@...ux.alibaba.com, muchun.song@...ux.dev,
osalvador@...e.de, liuzixing@...on.cn
Subject: Re: [PATCH V2] mm/hugetlb: remove unnecessary holding of hugetlb_lock
在 2025/6/5 6:47, Andrew Morton 写道:
> On Tue, 27 May 2025 11:36:50 +0800 yangge1116@....com wrote:
>
>> From: Ge Yang <yangge1116@....com>
>>
>> In the isolate_or_dissolve_huge_folio() function, after acquiring the
>> hugetlb_lock, it is only for the purpose of obtaining the correct hstate,
>> which is then passed to the alloc_and_dissolve_hugetlb_folio() function.
>>
>> The alloc_and_dissolve_hugetlb_folio() function itself also acquires the
>> hugetlb_lock. We can have the alloc_and_dissolve_hugetlb_folio() function
>> obtain the hstate by itself, so that the isolate_or_dissolve_huge_folio()
>> function no longer needs to acquire the hugetlb_lock. In addition, we keep
>> the folio_test_hugetlb() check within the isolate_or_dissolve_huge_folio()
>> function. By doing so, we can avoid disrupting the normal path by vainly
>> holding the hugetlb_lock.
>>
>> The replace_free_hugepage_folios() function has the same issue, and we
>> should address it as well.
>>
>
> This change addresses a possible performance issue which was introduced
> by 113ed54ad276 ("mm/hugetlb: fix kernel NULL pointer dereference when
> replacing free hugetlb folios"). 113ed54ad276 was added recently and
> was cc:stable.
>
> David said:
> https://lkml.kernel.org/r/87521d93-cc03-480d-a2ef-3ef8c84481c9@redhat.com
>
>
> Question is, will that bugfix's performance impact be sufficiently
> serious for us to also backport this new patch?
In some low-probability scenarios, there could be severe impacts. For
example, when multiple CPUs execute the replace_free_hugepage_folios()
function simultaneously. It seems that we need to backport this new
patch. Thank you.
Powered by blists - more mailing lists