Skip to contentSkip to conversation

update thp admin doc

PATCH Superseded Pankaj Raghav (Samsung) 3 participants 5 messages Apr 4, 2025

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover update thp admin doc

From: Pankaj Raghav <[email protected]>

Update the THP admin doc about non-tmpfs filesystem support and clarify certain variables for clarity.

Changes since v1:
- Added RVB from Bagas Sanjaya
- Expanded on ShmemHugePage, ShmemPmdMapped and FilePmdMapped based on the feedback from David

Pankaj Raghav (2):
docs: update THP admin guide about non-tmpfs filesystem support
docs: clarify THP admin guide about (File|Shmem)PmdMapped and
ShmemHugePage

 Documentation/admin-guide/mm/transhuge.rst | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

base-commit: f0a16f5363325cc8d9382471cdc7b654c53254c9

Signature · 1 line
2.47.2
#1 lore raw

PATCH v2 1/2 docs: update THP admin guide about non-tmpfs filesystem support

From: Pankaj Raghav <[email protected]>

THP support for non-tmpfs filesystem has been around for some time now. Update the admin guide to reflect it.

---
 Documentation/admin-guide/mm/transhuge.rst | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Documentation/admin-guide/mm/transhuge.rst +6 -2
index dff8d5985f0f..01b7ce90d693 100644
@@ -12,8 +12,8 @@ using huge pages for the backing of virtual memory with huge pages
 that supports the automatic promotion and demotion of page sizes and
 without the shortcomings of hugetlbfs.
 
-Currently THP only works for anonymous memory mappings and tmpfs/shmem.
-But in the future it can expand to other filesystems.
+Currently, THP only works for anonymous memory mappings, tmpfs/shmem and
+filesystems that support large folios.
 
 .. note::
    in the examples below we presume that the basic page size is 4K and
@@ -463,6 +463,10 @@ fields for each mapping. (Note that AnonHugePages only applies to traditional
 PMD-sized THP for historical reasons and should have been called
 AnonHugePmdMapped).
 
+The number of PMD-sized transparent huge pages currently used by
+filesystem data (page cache) is available by reading the FileHugePages field
+in ``/proc/meminfo``.
+
 The number of file transparent huge pages mapped to userspace is available
 by reading ShmemPmdMapped and ShmemHugePages fields in ``/proc/meminfo``.
 To identify what applications are mapping file transparent huge pages, it
Signature · 1 line
2.47.2
#2 lore raw

PATCH v2 2/2 docs: clarify THP admin guide about (File|Shmem)PmdMapped and ShmemHugePage

In reply to Pankaj Raghav (Samsung)

From: Pankaj Raghav <[email protected]>

Move FilePmdMapped to previous paragraph for clarity, and clarify ShmemPmdMapped & ShmemHugePage.

---
 Documentation/admin-guide/mm/transhuge.rst | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
Documentation/admin-guide/mm/transhuge.rst +10 -6
index 01b7ce90d693..b0b9d578732b 100644
@@ -465,13 +465,17 @@ AnonHugePmdMapped).
 
 The number of PMD-sized transparent huge pages currently used by
 filesystem data (page cache) is available by reading the FileHugePages field
-in ``/proc/meminfo``.
+in ``/proc/meminfo``. The number of these huge pages that are mapped to userspace
+is available by reading FilePmdMapped field in ``proc/meminfo``. To identify
+what applications are mapping these huge pages, it is necessary to read
+``/proc/PID/smaps`` and count the FilePmdMapped fields for each mapping.
 
-The number of file transparent huge pages mapped to userspace is available
-by reading ShmemPmdMapped and ShmemHugePages fields in ``/proc/meminfo``.
-To identify what applications are mapping file transparent huge pages, it
-is necessary to read ``/proc/PID/smaps`` and count the FilePmdMapped fields
-for each mapping.
+The number of PMD-sized transparent huge pages currently used by
+tmpfs/shmem is available by reading the ShmemHugePages field
+in ``/proc/meminfo``. The number of these huge pages that are mapped to userspace
+is available by reading ShmemPmdMapped field in ``proc/meminfo``. To identify
+what applications are mapping these huge pages, it is necessary to read
+``/proc/PID/smaps`` and count the ShmemPmdMapped fields for each mapping.
 
 Note that reading the smaps file is expensive and reading it
 frequently will incur overhead.
Signature · 1 line
2.47.2
#3 lore raw

Re: [PATCH v2 2/2] docs: clarify THP admin guide about (File|Shmem)PmdMapped and ShmemHugePage

Documentation/admin-guide/mm/transhuge.rst AnonHugePmdMapped). · line 473

Quoted 6 lines · Pankaj Raghav (Samsung)
Documentation/admin-guide/mm/transhuge.rst +1 -5
-The number of file transparent huge pages mapped to userspace is available
-by reading ShmemPmdMapped and ShmemHugePages fields in ``/proc/meminfo``.
-To identify what applications are mapping file transparent huge pages, it
-is necessary to read ``/proc/PID/smaps`` and count the FilePmdMapped fields
-for each mapping.
+The number of PMD-sized transparent huge pages currently used by

"In similar fashion, the number ..."

Documentation/admin-guide/mm/transhuge.rst AnonHugePmdMapped). · line 478

Quoted 6 lines
Documentation/admin-guide/mm/transhuge.rst +5 -0
+tmpfs/shmem is available by reading the ShmemHugePages field
+in ``/proc/meminfo``. The number of these huge pages that are mapped to userspace
+is available by reading ShmemPmdMapped field in ``proc/meminfo``. To identify
+what applications are mapping these huge pages, it is necessary to read
+``/proc/PID/smaps`` and count the ShmemPmdMapped fields for each mapping.

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
Acked-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] docs: clarify THP admin guide about (File|Shmem)PmdMapped and ShmemHugePage

In reply to Pankaj Raghav (Samsung)
Quoted 15 lines · Pankaj Raghav (Samsung)

From: Pankaj Raghav <[email protected]>

Move FilePmdMapped to previous paragraph for clarity, and clarify ShmemPmdMapped & ShmemHugePage.

---
  Documentation/admin-guide/mm/transhuge.rst | 16 ++++++++++------
  1 file changed, 10 insertions(+), 6 deletions(-)
Documentation/admin-guide/mm/transhuge.rst +0 -0
index 01b7ce90d693..b0b9d578732b 100644

Documentation/admin-guide/mm/transhuge.rst AnonHugePmdMapped). · line 472

Quoted 9 lines
Documentation/admin-guide/mm/transhuge.rst +4 -1
@@ -465,13 +465,17 @@ AnonHugePmdMapped).
 
  The number of PMD-sized transparent huge pages currently used by
  filesystem data (page cache) is available by reading the FileHugePages field
-in ``/proc/meminfo``.
+in ``/proc/meminfo``. The number of these huge pages that are mapped to userspace
+is available by reading FilePmdMapped field in ``proc/meminfo``. To identify
+what applications are mapping these huge pages, it is necessary to read
+``/proc/PID/smaps`` and count the FilePmdMapped fields for each mapping.
 

Having that change here looks weird.

I suggest to just squash both patches, they are intertwined.

Documentation/admin-guide/mm/transhuge.rst AnonHugePmdMapped). · line 478

Quoted 11 lines
Documentation/admin-guide/mm/transhuge.rst +6 -5
-The number of file transparent huge pages mapped to userspace is available
-by reading ShmemPmdMapped and ShmemHugePages fields in ``/proc/meminfo``.
-To identify what applications are mapping file transparent huge pages, it
-is necessary to read ``/proc/PID/smaps`` and count the FilePmdMapped fields
-for each mapping.
+The number of PMD-sized transparent huge pages currently used by
+tmpfs/shmem is available by reading the ShmemHugePages field
+in ``/proc/meminfo``. The number of these huge pages that are mapped to userspace
+is available by reading ShmemPmdMapped field in ``proc/meminfo``. To identify
+what applications are mapping these huge pages, it is necessary to read
+``/proc/PID/smaps`` and count the ShmemPmdMapped fields for each mapping.

Apart from that (and taking Bagas comment in account), LGTM.

Feel free to add

Signature · 3 lines
Cheers,

David / dhildenb