Re: [PATCH 1/2] mm/mempolicy: merge adjacent shared policy ranges
From: Zi Yan
Date: Mon Nov 16 2026 - 11:50:09 EST
On 13 Nov 2026, at 16:36, David Hildenbrand (Arm) wrote:
> Shared policies can retain separate tree nodes for adjacent ranges with
> identical policies. This can create unnecessary policy ranges especially
> when individual VMAs cover individual file ranges, and user space sets
> the policy on these VMAs independently.
>
> Extend the existing replacement handling to merge ranges with equal policy
> at either boundary. The existing replacement loop will then remove the old
> nodes and installs a single node for the combined range. This also avoids
> splitting an existing node when setting the same policy on a subrange.
>
> Extending either boundary rules out splitting an existing node, so the
> allocation retry can only occur with the originally requested range.
>
> This change will make it easier to cap the number of shared policy
> ranges per inode.
>
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> ---
> mm/mempolicy.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
Makes sense to me.
Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>
Best Regards,
Yan, Zi