Commit e7b1e851 authored by Barry Song's avatar Barry Song Committed by Kefeng Wang
Browse files

mm: add docs for per-order mTHP counters and transhuge_page ABI

next inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9Q9DF
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=42248b9d34ea1be1b959d343fff465906cb787fc

--------------------------------

This patch includes documentation for mTHP counters and an ABI file for
sys-kernel-mm-transparent-hugepage, which appears to have been missing for
some time.

[v-songbaohua@oppo.com: fix the name and unexpected indentation]
  Link: https://lkml.kernel.org/r/20240415054538.17071-1-21cnbao@gmail.com
Link: https://lkml.kernel.org/r/20240412114858.407208-4-21cnbao@gmail.com


Signed-off-by: default avatarBarry Song <v-songbaohua@oppo.com>
Reviewed-by: default avatarRyan Roberts <ryan.roberts@arm.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Cc: Chris Li <chrisl@kernel.org>
Cc: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
Cc: Kairui Song <kasong@tencent.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Yosry Ahmed <yosryahmed@google.com>
Cc: Yu Zhao <yuzhao@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent e7cfecd5
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
What:		/sys/kernel/mm/transparent_hugepage/
Date:		April 2024
Contact:	Linux memory management mailing list <linux-mm@kvack.org>
Description:
		/sys/kernel/mm/transparent_hugepage/ contains a number of files and
		subdirectories,

			- defrag
			- enabled
			- hpage_pmd_size
			- khugepaged
			- shmem_enabled
			- use_zero_page
			- subdirectories of the form hugepages-<size>kB, where <size>
			  is the page size of the hugepages supported by the kernel/CPU
			  combination.

		See Documentation/admin-guide/mm/transhuge.rst for details.
+28 −0
Original line number Diff line number Diff line
@@ -474,6 +474,34 @@ thp_swpout_fallback
	Usually because failed to allocate some continuous swap space
	for the huge page.

In /sys/kernel/mm/transparent_hugepage/hugepages-<size>kB/stats, There are
also individual counters for each huge page size, which can be utilized to
monitor the system's effectiveness in providing huge pages for usage. Each
counter has its own corresponding file.

anon_fault_alloc
	is incremented every time a huge page is successfully
	allocated and charged to handle a page fault.

anon_fault_fallback
	is incremented if a page fault fails to allocate or charge
	a huge page and instead falls back to using huge pages with
	lower orders or small pages.

anon_fault_fallback_charge
	is incremented if a page fault fails to charge a huge page and
	instead falls back to using huge pages with lower orders or
	small pages even though the allocation was successful.

anon_swpout
	is incremented every time a huge page is swapped out in one
	piece without splitting.

anon_swpout_fallback
	is incremented if a huge page has to be split before swapout.
	Usually because failed to allocate some continuous swap space
	for the huge page.

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