linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] smaps: count large pages smaller than PMD size to anonymous_thp
@ 2024-12-03 13:49 Wenchao Hao
  2024-12-03 14:17 ` David Hildenbrand
  0 siblings, 1 reply; 15+ messages in thread
From: Wenchao Hao @ 2024-12-03 13:49 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand, Matthew Wilcox, Oscar Salvador,
	Muhammad Usama Anjum, Andrii Nakryiko, Ryan Roberts, Peter Xu,
	Barry Song, linux-kernel, linux-fsdevel, linux-mm
  Cc: Wenchao Hao

Currently, /proc/xxx/smaps reports the size of anonymous huge pages for
each VMA, but it does not include large pages smaller than PMD size.

This patch adds the statistics of anonymous huge pages allocated by
mTHP which is smaller than PMD size to AnonHugePages field in smaps.

Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
---
 fs/proc/task_mmu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 38a5a3e9cba2..b655011627d8 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -717,6 +717,12 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page,
 		if (!folio_test_swapbacked(folio) && !dirty &&
 		    !folio_test_dirty(folio))
 			mss->lazyfree += size;
+
+		/*
+		 * Count large pages smaller than PMD size to anonymous_thp
+		 */
+		if (!compound && PageHead(page) && folio_order(folio))
+			mss->anonymous_thp += folio_size(folio);
 	}
 
 	if (folio_test_ksm(folio))
-- 
2.45.0



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-12-20  6:49 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-03 13:49 [PATCH] smaps: count large pages smaller than PMD size to anonymous_thp Wenchao Hao
2024-12-03 14:17 ` David Hildenbrand
2024-12-03 14:42   ` Ryan Roberts
2024-12-04 14:40     ` Wenchao Hao
2024-12-04 17:05       ` Ryan Roberts
2024-12-16 15:58         ` Wenchao Hao
2024-12-20  6:48           ` Dev Jain
2024-12-04 14:30   ` Wenchao Hao
2024-12-04 14:37     ` David Hildenbrand
2024-12-04 14:47       ` Wenchao Hao
2024-12-04 17:07     ` Ryan Roberts
2024-12-06 11:16   ` Lance Yang
2024-12-08  6:06     ` Barry Song
2024-12-09 10:07       ` Ryan Roberts
2024-12-16 16:03       ` Wenchao Hao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox