Re: [PATCH] docs: update THP documentation to clarify sysfs "never" setting

From: Baolin Wang
Date: Tue Jul 22 2025 - 02:00:03 EST




On 2025/7/22 13:34, Lorenzo Stoakes wrote:
Hi Andrew,

Could you apply this fix-patch? It adds the caveat regarding MADV_COLLAPSE in a
couple other places whwere the sysfs 'never' mode is mentioned.

Thanks, Lorenzo

----8<----
From 7c0bdda6a633bc38e7d5a3b0acf2cef7bdc961af Mon Sep 17 00:00:00 2001
From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Date: Tue, 22 Jul 2025 06:32:18 +0100
Subject: [PATCH] docs: update admin guide transhuge page to mention
MADV_COLLAPSE everywhere

We previously missed a couple places where the 'never' mode was described,
put the caveat regarding MADV_COLLAPSE in these locations also.

Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>

Thanks.
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>

---
Documentation/admin-guide/mm/transhuge.rst | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst
index 182519197ef7..370fba113460 100644
--- a/Documentation/admin-guide/mm/transhuge.rst
+++ b/Documentation/admin-guide/mm/transhuge.rst
@@ -385,7 +385,9 @@ always
Attempt to allocate huge pages every time we need a new page;

never
- Do not allocate huge pages;
+ Do not allocate huge pages. Note that ``madvise(..., MADV_COLLAPSE)``
+ can still cause transparent huge pages to be obtained even if this mode
+ is specified everywhere;

within_size
Only allocate huge page if it will be fully within i_size.
@@ -441,7 +443,9 @@ inherit
have enabled="inherit" and all other hugepage sizes have enabled="never";

never
- Do not allocate <size> huge pages;
+ Do not allocate <size> huge pages. Note that ``madvise(...,
+ MADV_COLLAPSE)`` can still cause transparent huge pages to be obtained
+ even if this mode is specified everywhere;

within_size
Only allocate <size> huge page if it will be fully within i_size.
--
2.50.1