Re: [PATCH v3 1/7] mm: support promotion-only NUMA hinting scans
From: David Hildenbrand (Arm)
Date: Thu Sep 24 2026 - 07:49:54 EST
On 9/22/26 20:29, Gregory Price wrote:
> From: "Gregory Price (Meta)" <gourry@xxxxxxxxxx>
>
> folio_can_map_prot_numa() derives folio eligibility from the global
> balancing mode. The mode (normal, tiering, or combined) describes
> which balancing mechanisms are enabled (placement vs promotion).
>
> The global setting itself cannot describe the intent of an individual
> protection walk because normal-mode tempers its scanning activity based
> on a number of heuristics (read-only VMAs, activeness of VMA, etc).
>
> In tiering or combined mode, applying these normal-mode optimizations
> to an entire VMA is incorrect and breaks tiering.
>
> - Opting VMAs out of scanning because they became inactive obviously
> breaks tiering - because the intent is to identify when a VMA
> becomes active. Applying it in tiering modes causes
Incomplete sentence.
>
> - Opting Read-only file VMAs out of scanning is just incorrect for
> tiering modes because its intent is to prevent bouncing between
> sockets (east-west), while tiering controls tier migration
> (north-south). The result is hot read-only files can overload
> lower tier bandwidth.
>
> Add MM_CP_PROT_NUMA_PROMO_ONLY and let task_numa_work() select the type
> of walk. Build the change-protection flags there and pass them unchanged
> through change_prot_numa() so its PTE/PMD paths use the same decision.
>
> Have folio_can_map_prot_numa() derive the single-threaded private state at
> the point of use instead of adding another precomputed boolean to the
> protection-walk interface. This keeps the interface focused on scan intent
> and avoids plumbing VMA-derived state beside cp_flags.
>
> The tradeoff for the cleaner interface is an atomic mm_users read for each
> folio, rather than once per PTE range. Check the promotion-only top-tier
> exclusion bit first as a mild optimization.
>
> The scan-intent interface is required by the following memory-tiering
> fixes and must accompany them when backported.
>
> Fixes: c574bbe91703 ("NUMA balancing: optimize page placement for memory tiering system")
> Cc: stable@xxxxxxxxxxxxxxx
> Suggested-by: David Hildenbrand <david@xxxxxxxxxx>
> Link: https://lore.kernel.org/r/4d2853c9-edf4-4685-b186-7214ed6abd84@xxxxxxxxxx
> Assisted-by: LLM
> Signed-off-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
> ---
LGTM
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
--
Cheers,
David