Re: [PATCH v5 6/6] mm: shmem: add mTHP counters for anonymous shmem

From: Baolin Wang
Date: Wed Jun 12 2024 - 21:08:59 EST




On 2024/6/12 22:18, Lance Yang wrote:
On Tue, Jun 11, 2024 at 6:11 PM Baolin Wang
<baolin.wang@xxxxxxxxxxxxxxxxx> wrote:

Add mTHP counters for anonymous shmem.

Signed-off-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>

LGTM. Feel free to add:
Reviewed-by: Lance Yang <ioworker0@xxxxxxxxx>

Thanks.


Just a friendly reminder: We also need to update the documentation
for the counters in transhuge.rst.

Indeed.

Andrew, could you help to fold following changes into this patch? Thanks.

diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst
index e7232b46fe14..8f6ffbfc4b16 100644
--- a/Documentation/admin-guide/mm/transhuge.rst
+++ b/Documentation/admin-guide/mm/transhuge.rst
@@ -501,6 +501,19 @@ swpout_fallback
Usually because failed to allocate some continuous swap space
for the huge page.

+file_alloc
+ is incremented every time a file huge page is successfully
+ allocated.
+
+file_fallback
+ is incremented if a file huge page is attempted to be allocated
+ but fails and instead falls back to using small pages.
+
+file_fallback_charge
+ is incremented if a file huge page cannot be charged and instead
+ falls back to using small pages even though the allocation was
+ successful.
+
As the system ages, allocating huge pages may be expensive as the
system uses memory compaction to copy data around memory to free a
huge page for use. There are some counters in ``/proc/vmstat`` to help