Re: [Chapter Two] THP shattering: the reverse of collapsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29 Feb 2024, at 13:34, Yu Zhao wrote:

> In contrast to split, shatter migrates occupied pages in a partially
> mapped THP to a bunch of base folios. IOW, unlike split done in place,
> shatter is the exact opposite of collapse.
>
> The advantage of shattering is that it keeps the original THP intact.

Why keep the THP intact? To prevent the THP from fragmentation, since
the shattered part will not be returned to buddy allocator for reuse?

I agree with the idea of shattering, but keeping THP intact might
give us trouble for 1GB THP case when PMD mapping is created after
shattering. How to update mapcount for a PMD mapping in the middle of
a 1GB folio? I used head[0], head[512], ... as the PMD mapping head
page, but that is ugly. For mTHPs, there is no such problem since
only PTE mappings are involved.

It might be better to just split the THP and move free pages to a
donot-use free list until the rest are freed too, if the zone enforces
a minimal order that is larger than the free pages.

> The cost of copying during the migration is not a side effect, but
> rather by design, since splitting is considered a discouraged
> behavior. In retail terms, the return of a purchase is charged with a
> restocking fee and the original goods can be resold.
>
> THPs from ZONE_NOMERGE can only be shattered, since they cannot be
> split or merged. THPs from ZONE_NOSPLIT can be shattered or split (the
> latter requires [1]), if they are above the minimum order.
>
> [1] https://lore.kernel.org/20240226205534.1603748-1-zi.yan@xxxxxxxx/
>


--
Best Regards,
Yan, Zi

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux