Re: [PATCH v2 32/35] mm/hugetlb: stop accounting HugetlbPages once PMD tables were shared
From: Jose A. Perez de Azpillaga
Date: Fri Dec 04 2026 - 06:51:32 EST
On 12/3/26 12:37 PM, David Hildenbrand (Arm) wrote:
> Sharing hugetlb PMD tables can leave HugetlbPages in /proc/<pid>/status
> too low or too high, or make it underflow: when (un)mapping a folio in a
> shared PMD table, we only adjust mm->hugetlb_usage of the MM we process,
> not of the other sharers.
>
> Accounting this precisely is not worth it for a statistic, so let's just
> give up: once an MM shares a PMD table, set mm->hugetlb_usage of both
> MMs to LONG_MIN / 2, and report negative values as 0. Later updates
> cannot realistically make it positive again, as PMD table sharing is
> 64-bit only.
>
> Document that HugetlbPages is 0 once a process shared hugetlb PMD page
> tables.
>
> This has low urgency, as it only affects a statistic. 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