[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241203134949.2588947-1-haowenchao22@gmail.com>
Date: Tue, 3 Dec 2024 21:49:49 +0800
From: Wenchao Hao <haowenchao22@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...hat.com>,
Matthew Wilcox <willy@...radead.org>,
Oscar Salvador <osalvador@...e.de>,
Muhammad Usama Anjum <usama.anjum@...labora.com>,
Andrii Nakryiko <andrii@...nel.org>,
Ryan Roberts <ryan.roberts@....com>,
Peter Xu <peterx@...hat.com>,
Barry Song <21cnbao@...il.com>,
linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org
Cc: Wenchao Hao <haowenchao22@...il.com>
Subject: [PATCH] smaps: count large pages smaller than PMD size to anonymous_thp
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@...il.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
Powered by blists - more mailing lists