Hi Andrew,
On 26 Feb 2024, at 15:55, Zi Yan wrote:
From: Zi Yan ziy@nvidia.com
To split a THP to any lower order pages, we need to reform THPs on subpages at given order and add page refcount based on the new page order. Also we need to reinitialize page_deferred_list after removing the page from the split_queue, otherwise a subsequent split will see list corruption when checking the page_deferred_list again.
Note: Anonymous 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. File-backed order-1 folios are fine, since they do not use _deferred_list.
Signed-off-by: Zi Yan ziy@nvidia.com
include/linux/huge_mm.h | 21 +++++--- mm/huge_memory.c | 110 +++++++++++++++++++++++++++++++--------- 2 files changed, 99 insertions(+), 32 deletions(-)
Can you fold the fixup below into this patch (per discussion with Ryan at [1])? Thanks.
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 50d146eb248f..fd745bcc97ff 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3059,11 +3059,8 @@ int split_huge_page_to_list_to_order(struct page *page, struct list_head *list,
if (new_order) { /* Only swapping a whole PMD-mapped folio is supported */ - if (folio_test_swapcache(folio)) { - VM_WARN_ONCE(1, - "Cannot split swap-cached folio to non-0 order"); + if (folio_test_swapcache(folio)) return -EINVAL; - } /* Split shmem folio to non-zero order not supported */ if (shmem_mapping(folio->mapping)) { VM_WARN_ONCE(1,
[1] https://lore.kernel.org/linux-mm/408df79a-130e-43cd-a21a-9b3a2ddef617@arm.co...
-- Best Regards, Yan, Zi