Re: [PATCH v5 8/8] mm: huge_memory: enable debugfs to split huge pages to any order.
From: Zi Yan
Date: Thu Mar 07 2024 - 10:07:10 EST
On 26 Feb 2024, at 15:55, Zi Yan wrote:
> From: Zi Yan <ziy@xxxxxxxxxx>
>
> It is used to test split_huge_page_to_list_to_order for pagecache THPs.
> Also add test cases for split_huge_page_to_list_to_order via both
> debugfs.
>
> Signed-off-by: Zi Yan <ziy@xxxxxxxxxx>
> ---
> mm/huge_memory.c | 34 ++++--
> .../selftests/mm/split_huge_page_test.c | 115 +++++++++++++++++-
> 2 files changed, 131 insertions(+), 18 deletions(-)
Hi Andrew,
This is the fixup for patch 8. It is based on the discussion
with Dan Carpenter at https://lore.kernel.org/linux-mm/7dda9283-b437-4cf8-ab0d-83c330deb9c0@moroto.mountain/. It checks new_order input from
debugfs and skips folios early if new_order is greater than the folio order.
Thanks.
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index a81a09236c16..42d4f62d7760 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3484,6 +3484,9 @@ static int split_huge_pages_pid(int pid, unsigned long vaddr_start,
goto next;
total++;
+
+ if (new_order >= folio_order(folio))
+ goto next;
/*
* For folios with private, split_huge_page_to_list_to_order()
* will try to drop it before split and then check if the folio
@@ -3550,6 +3553,9 @@ static int split_huge_pages_in_file(const char *file_path, pgoff_t off_start,
total++;
nr_pages = folio_nr_pages(folio);
+ if (new_order >= folio_order(folio))
+ goto next;
+
if (!folio_trylock(folio))
goto next;
--
Best Regards,
Yan, Zi
Attachment:
signature.asc
Description: OpenPGP digital signature