Re: [PATCH v3 09/18] mm/huge_memory: move anon_vma and filemap management into split helpers

From: David Hildenbrand (Arm)

Date: Thu Aug 27 2026 - 12:40:22 EST


On 8/20/26 20:55, Kairui Song via B4 Relay wrote:
> From: Kairui Song <kasong@xxxxxxxxxxx>
>
> Only anon split needs vma info, and only file split needs the filemap
> handling. Move the related code into separate helpers so they are
> genuinely more self-contained.

This patch seems to do more than that, like relocating the
folio_expected_ref_count check (and duplicating it, which is not so nice).

>
> Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>
> Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
> ---

[...]

> - /*
> - * Racy check if we can split the page, before unmap_folio() will
> - * split PMDs
> - */
> - if (folio_expected_ref_count(folio) != folio_ref_count(folio) - 1) {
> - ret = -EAGAIN;
> - goto out_unlock;
> - }
> -
> - if (!is_anon) {
> - ret = __folio_split_unmap_and_freeze_file(folio, new_order, split_at, &xas, mapping,
> - true, list, split_type);
> - } else {
> + if (is_anon)
> ret = __folio_split_unmap_and_freeze_anon(folio, new_order, split_at, true,
> true, list, split_type);
> - }

Inverting the conditional seems to produce unnecessary noise in this patch.



--
Cheers,

David