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@xxxxxxxxxx> >>> Cc: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx> >>> Cc: David Hildenbrand <david@xxxxxxxxxx> >>> Cc: Hugh Dickins <hughd@xxxxxxxxxx> >>> Cc: John Hubbard <jhubbard@xxxxxxxxxx> >>> Cc: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> >>> Cc: Kirill A. Shuemov <kirill.shutemov@xxxxxxxxxxxxxxx> >>> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> >>> Cc: Miaohe Lin <linmiaohe@xxxxxxxxxx> >>> Cc: Ryan Roberts <ryan.roberts@xxxxxxx> >>> Cc: Yang Shi <yang@xxxxxxxxxxxxxxxxxxxxxx> >>> Cc: Yu Zhao <yuzhao@xxxxxxxxxx> >>> Cc: Kairui Song <kasong@xxxxxxxxxxx> >>> --- >>> 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.