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 <z...@nvidia.com>
>>> Cc: Baolin Wang <baolin.w...@linux.alibaba.com>
>>> Cc: David Hildenbrand <da...@redhat.com>
>>> Cc: Hugh Dickins <hu...@google.com>
>>> Cc: John Hubbard <jhubb...@nvidia.com>
>>> Cc: Kefeng Wang <wangkefeng.w...@huawei.com>
>>> Cc: Kirill A. Shuemov <kirill.shute...@linux.intel.com>
>>> Cc: Matthew Wilcox <wi...@infradead.org>
>>> Cc: Miaohe Lin <linmia...@huawei.com>
>>> Cc: Ryan Roberts <ryan.robe...@arm.com>
>>> Cc: Yang Shi <y...@os.amperecomputing.com>
>>> Cc: Yu Zhao <yuz...@google.com>
>>> Cc: Kairui Song <kas...@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:
> 1. Hugh’s fix on unfreezing head folio correctly,
> 2. Hugh’s fix on drop the right number of refs on tail folio,
> 3. 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 <z...@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 <l...@intel.com>
Closes: 
https://lore.kernel.org/oe-kbuild-all/202503131109.s7iuwfgq-...@intel.com/
Signed-off-by: Zi Yan <z...@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))
-- 
2.47.2



Best Regards,
Yan, Zi

Reply via email to