Re: [PATCH 2/2] mm: support multi-size THP numa balancing

From: Huang, Ying
Date: Wed Mar 27 2024 - 04:23:09 EST


Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx> writes:

> On 2024/3/27 10:04, Huang, Ying wrote:
>> Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx> writes:
>>
>>> Now the anonymous page allocation already supports multi-size THP (mTHP),
>>> but the numa balancing still prohibits mTHP migration even though it is an
>>> exclusive mapping, which is unreasonable.
>>>
>>> Allow scanning mTHP:
>>> Commit 859d4adc3415 ("mm: numa: do not trap faults on shared data section
>>> pages") skips shared CoW pages' NUMA page migration to avoid shared data
>>> segment migration. In addition, commit 80d47f5de5e3 ("mm: don't try to
>>> NUMA-migrate COW pages that have other uses") change to use page_count()
>>> to avoid GUP pages migration, that will also skip the mTHP numa scaning.
>>> Theoretically, we can use folio_maybe_dma_pinned() to detect the GUP
>>> issue, although there is still a GUP race, the issue seems to have been
>>> resolved by commit 80d47f5de5e3. Meanwhile, use the folio_likely_mapped_shared()
>>> to skip shared CoW pages though this is not a precise sharers count. To
>>> check if the folio is shared, ideally we want to make sure every page is
>>> mapped to the same process, but doing that seems expensive and using
>>> the estimated mapcount seems can work when running autonuma benchmark.
>> Because now we can deal with shared mTHP, it appears even possible
>> to
>> remove folio_likely_mapped_shared() check?
>
> IMO, the issue solved by commit 859d4adc3415 is about shared CoW
> mapping, and I prefer to measure it in another patch:)

I mean we can deal with shared mTHP (by multiple threads or multiple
processes) with this patch. Right?

[snip]

--
Best Regards,
Huang, Ying