Re: [PATCH v5 11/17] mm/huge_memory: move filemap management into the file split helper
From: David Hildenbrand (Arm)
Date: Fri Sep 18 2026 - 16:57:52 EST
On 9/14/26 19:14, Kairui Song via B4 Relay wrote:
> From: Kairui Song <kasong@xxxxxxxxxxx>
>
> Only file split needs the filemap and xarray handling and related
> variables. Move them out of __folio_split() into the file helper so
> the helper is self-contained, and simplify the parameters.
>
> No functional change.
>
> Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>
> Reviewed-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
> Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
> ---
> mm/huge_memory.c | 102 ++++++++++++++++++++++++-------------------------------
> 1 file changed, 44 insertions(+), 58 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 859aefda7356..8fc1dd5b8354 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -4107,16 +4107,42 @@ static int __folio_freeze_split_anon(struct folio *folio,
>
> static int __folio_freeze_split_file(struct folio *folio,
> unsigned int new_order, struct page *split_at,
> - struct xa_state *xas, struct address_space *mapping,
> bool do_lru, struct list_head *list,
> enum split_type split_type)
> {
> + struct address_space *mapping = folio->mapping;
> + XA_STATE(xas, &mapping->i_pages, folio->index);
> struct folio *end_folio = folio_next(folio);
> struct folio *new_folio, *next;
> int nr_shmem_dropped = 0;
> + unsigned int min_order;
> struct lruvec *lruvec;
> pgoff_t end;
> - int ret;
> + gfp_t gfp;
> + int ret = 0;
> +
> + min_order = mapping_min_folio_order(mapping);
> + if (new_order < min_order)
> + return -EINVAL;
> +
> + gfp = current_gfp_context(mapping_gfp_mask(mapping) & GFP_RECLAIM_MASK);
> + if (!filemap_release_folio(folio, gfp))
> + return -EBUSY;
> +
> + mapping_set_update(&xas, mapping);
> +
> + if (split_type == SPLIT_TYPE_UNIFORM) {
> + int old_order = folio_order(folio);
Can be const
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
--
Cheers,
David