On 10 Mar 2025, at 13:32, Zi Yan wrote:
On 10 Mar 2025, at 12:14, Zi Yan wrote:
On 7 Mar 2025, at 12:39, Zi Yan wrote:
This is a preparation patch, both added functions are not used yet.
The added __split_unmapped_folio() is able to split a folio with its mapping removed in two manners: 1) uniform split (the existing way), and 2) buddy allocator like (or non-uniform) split.
The added __split_folio_to_order() can split a folio into any lower order. For uniform split, __split_unmapped_folio() calls it once to split the given folio to the new order. For buddy allocator like (non-uniform) split, __split_unmapped_folio() calls it (folio_order - new_order) times and each time splits the folio containing the given page to one lower order.
Signed-off-by: Zi Yan ziy@nvidia.com Cc: Baolin Wang baolin.wang@linux.alibaba.com Cc: David Hildenbrand david@redhat.com Cc: Hugh Dickins hughd@google.com Cc: John Hubbard jhubbard@nvidia.com Cc: Kefeng Wang wangkefeng.wang@huawei.com Cc: Kirill A. Shuemov kirill.shutemov@linux.intel.com Cc: Matthew Wilcox willy@infradead.org Cc: Miaohe Lin linmiaohe@huawei.com Cc: Ryan Roberts ryan.roberts@arm.com Cc: Yang Shi yang@os.amperecomputing.com Cc: Yu Zhao yuzhao@google.com Cc: Kairui Song kasong@tencent.com
mm/huge_memory.c | 348 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 347 insertions(+), 1 deletion(-)
Hi Andrew,
The patch below should fix the issues discovered by Hugh. Please fold it into this patch. Thank you for all the help.
Hi Andrew,
This is the updated version including:
- Hugh’s fix on unfreezing head folio correctly,
- Hugh’s fix on drop the right number of refs on tail folio,
- Matthew’s suggestion on using new_folio instead of new_head and
using i instead of index.
Hi Andrew,
The fixup below should get rid of the sparse warning.
From 83472fe89330a262facba427051426e8cd13e218 Mon Sep 17 00:00:00 2001 From: Zi Yan ziy@nvidia.com Date: Thu, 13 Mar 2025 10:04:20 -0400 Subject: [PATCH] mm/huge_memory: use NULL instead of 0 for folio->private assignment.
It makes sparse happy.
Reported-by: kernel test robot lkp@intel.com Closes: https://lore.kernel.org/oe-kbuild-all/202503131109.s7iuWfGq-lkp@intel.com/ Signed-off-by: Zi Yan ziy@nvidia.com --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 14b1963898a7..e3ed8e9523f5 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3369,7 +3369,7 @@ static void __split_folio_to_order(struct folio *folio, int old_order, */ if (unlikely(new_folio->private)) { VM_WARN_ON_ONCE_PAGE(true, new_head); - new_folio->private = 0; + new_folio->private = NULL; }
if (folio_test_swapcache(folio))