Re: [PATCH 3/3] fs/proc/task_mmu: account device-private PMDs as present in smaps
From: David Hildenbrand (Arm)
Date: Thu Nov 12 2026 - 04:12:53 EST
On 11/11/26 12:38, Usama Arif wrote:
> Device-private PMDs represent mapped pages, but smaps_pmd_entry()
> passes present=false to smaps_account(). That treats them like migration
> entries: mapcounts are ignored, PSS is charged in full, and exclusive
> mappings are accounted as shared.
>
> Match smaps_pte_entry() and mark device-private PMDs as present so
> smaps_account() uses mapcounts for PSS and private/shared accounting.
>
> Fixes: a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>
> ---
> fs/proc/task_mmu.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index c0d391186c2b8..ad97532fc1184 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -1032,8 +1032,11 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
> } else if (unlikely(thp_migration_supported())) {
> const softleaf_t entry = softleaf_from_pmd(*pmd);
>
> - if (softleaf_has_pfn(entry))
> + if (softleaf_has_pfn(entry)) {
> + if (softleaf_is_device_private(entry))
> + present = true;
> page = softleaf_to_page(entry);
> + }
> }
I think I even spelled that out somewhere at some point while touching that code
... or did I fix the smaps_pte_entry() thing at some point?
"present" is a bit misleading in general, because it's not pte_present() ...
Matches smaps_pte_entry()
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
--
Cheers,
David