[PATCH RFC 05/13] fs/proc/task_mmu: remove mapcount comment in smaps_account()

David Hildenbrand (Arm)
2026-04-12T19:00:30Z

Reading the mapcount is a usually a snapshot that can change immediately
afterwards, except when the folio is locked and the folio is unmapped.

For example, nothing stops other folio/page mappings that are not protected
through the same PTL from going away; the folio lock cannot prevent that
situation.

Let's just drop the comment.

Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
fs/proc/task_mmu.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 1e1572849fed..55b037768c60 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -968,11 +968,6 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page,
exclusive = !folio_maybe_mapped_shared(folio);
}

- /*
- * We obtain a snapshot of the mapcount. Without holding the folio lock
- * this snapshot can be slightly wrong as we cannot always read the
- * mapcount atomically.
- */
for (i = 0; i < nr; i++, page++) {
unsigned long pss = PAGE_SIZE << PSS_SHIFT;

--
2.43.0