Re: [PATCH v2 31/35] mm/hugetlb: count migration entries at fork and unmap
From: Jose A. Perez de Azpillaga
Date: Fri Dec 04 2026 - 06:49:14 EST
On 12/3/26 12:37 PM, David Hildenbrand (Arm) wrote:
> HugetlbPages in /proc/<pid>/status can be wrong, and even drop below
> zero, if we fork() or unmap while mapped hugetlb folios are being
> migrated.
>
> There is an inconsistency: when installing migration entries we don't
> adjust the counter, treating them as if they were present. However, when
> copying or unmapping a migration entry, we don't adjust the counter like
> we would for a present entry.
>
> Let's fix it by adjusting the counter also for migration entries in
> these cases. Add pte_is_migration_entry() like we did for other softleaf
> types already.
>
> This has low urgency and given that this has been around forever and
> likely nobody cares, let's not CC stable.
>
> Fixes: 5d317b2b6536 ("mm: hugetlb: proc: add HugetlbPages field to /proc/PID/status")
> Reported-by: Chris Mason <mason@xxxxxxxxxx>
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
LGTM:
Reviewed-by: Jose A. Perez de Azpillaga <azpijr@xxxxxxxxx>
--
cheers,
jose a. p-a