Re: [PATCH v4 5/7] mm: thp: split huge page to any lower order pages (except order-1).

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

 



On 13 Feb 2024, at 17:19, Zi Yan wrote:

> On 13 Feb 2024, at 17:15, Zi Yan wrote:
>
>> On 13 Feb 2024, at 17:05, Luis Chamberlain wrote:
>>
>>> On Tue, Feb 13, 2024 at 04:55:18PM -0500, Zi Yan wrote:
>>>> From: Zi Yan <ziy@xxxxxxxxxx>
>>>> Order-1 folio is not supported because _deferred_list, which is used by
>>>> partially mapped folios, is stored in subpage 2 and an order-1 folio only
>>>> has subpage 0 and 1.
>>>
>>> The LBS patches has the patch from Matthew which enables and allowed us
>>> to successfully test order 1. So this restriction could be dropped if
>>> that gets merged.
>>
>> OK. But it only applies to file-backed folios IIUC. Anonymous folios still
>> cannot be split to order-1.
>
> Something like this would lift the restriction:

Actually this, since folio_prep_large_rmappable() is changed by that patch:

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 0564b007cbd1..05eeeafaa9dc 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2852,7 +2852,7 @@ static void __split_huge_page_tail(struct folio *folio, int tail,
        clear_compound_head(page_tail);
        if (new_order) {
                prep_compound_page(page_tail, new_order);
-               folio_prep_large_rmappable(page_folio(page_tail));
+               new_folio = folio_prep_large_rmappable(new_folio);
        }

        /* Finally unfreeze refcount. Additional reference from page cache. */
@@ -3045,9 +3045,9 @@ int split_huge_page_to_list_to_order(struct page *page, struct list_head *list,
        VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
        VM_BUG_ON_FOLIO(!folio_test_large(folio), folio);

-       /* Cannot split THP to order-1 (no order-1 THPs) */
-       if (new_order == 1) {
-               VM_WARN_ONCE(1, "Cannot split to order-1 folio");
+       /* Cannot split anonymous folios to order-1 (no order-1 anon folios) */
+       if (new_order == 1 && folio_test_anon(folio)) {
+               VM_WARN_ONCE(1, "Cannot split to order-1 anonymous folio");
                return -EINVAL;
        }

--
Best Regards,
Yan, Zi

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux