Re: [PATCH v2] PR_*ET_THP_DISABLE.2const: document addition of PR_THP_DISABLE_EXCEPT_ADVISED
From: Usama Arif <hidden>
Date: 2025-11-05 13:49:35
Also in:
lkml
On 05/11/2025 16:48, Usama Arif wrote:
PR_THP_DISABLE_EXCEPT_ADVISED extended PR_SET_THP_DISABLE to only provide THPs when advised. IOW, it allows individual processes to opt-out of THP = "always" into THP = "madvise", without affecting other workloads on the system. The series has been merged in [1]. Before [1], the following 2 calls were allowed with PR_SET_THP_DISABLE: prctl(PR_SET_THP_DISABLE, 0, 0, 0, 0); // to reset THP setting. prctl(PR_SET_THP_DISABLE, 1, 0, 0, 0); // to disable THPs completely. Now in addition to the 2 calls above, you can do: prctl(PR_SET_THP_DISABLE, 1, PR_THP_DISABLE_EXCEPT_ADVISED, 0, 0); // to disable THPs except madvise. This patch documents the changes introduced due to the addition of PR_THP_DISABLE_EXCEPT_ADVISED flag: - PR_GET_THP_DISABLE returns a value whose bits indicate how THP-disable is configured for the calling thread (with or without PR_THP_DISABLE_EXCEPT_ADVISED). - PR_SET_THP_DISABLE now uses arg3 to specify whether to disable THP completely for the process, or disable except madvise (PR_THP_DISABLE_EXCEPT_ADVISED). [1] https://github.com/torvalds/linux/commit/9dc21bbd62edeae6f63e6f25e1edb7167452457b Signed-off-by: Usama Arif <redacted> --- v1 -> v2 (Alejandro Colomar): - Fixed double negation on when MADV_HUGEPAGE will succeed - Turn return values of PR_GET_THP_DISABLE into a table - Turn madvise calls into full italics - Use semantic newlines --- man/man2/madvise.2 | 6 ++- man/man2const/PR_GET_THP_DISABLE.2const | 20 +++++++--- man/man2const/PR_SET_THP_DISABLE.2const | 52 +++++++++++++++++++++---- 3 files changed, 64 insertions(+), 14 deletions(-)
Resending this for review as the patch to implement this is in merged [1] [1] https://github.com/torvalds/linux/commit/9dc21bbd62edeae6f63e6f25e1edb7167452457b