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@vger.kernel.org Signed-off-by: Usama Arif Acked-by: Lorenzo Stoakes (ARM) Acked-by: David Hildenbrand (Arm) Reviewed-by: Zi Yan Reviewed-by: Kiryl Shutsemau (Meta) --- 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 34aaf80cd46cc2..fd32840a8cd7c3 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1034,8 +1034,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(pmdval); - if (softleaf_has_pfn(entry)) + if (softleaf_has_pfn(entry)) { + if (softleaf_is_device_private(entry)) + present = true; page = softleaf_to_page(entry); + } } if (IS_ERR_OR_NULL(page)) return; -- 2.53.1-Meta