linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/7] prctl: extend PR_SET_THP_DISABLE to only provide THPs when advised
@ 2025-08-15 13:54 Usama Arif
  2025-08-15 13:54 ` [PATCH v5 1/7] prctl: extend PR_SET_THP_DISABLE to optionally exclude VM_HUGEPAGE Usama Arif
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Usama Arif @ 2025-08-15 13:54 UTC (permalink / raw)
  To: Andrew Morton, david, linux-mm
  Cc: linux-fsdevel, corbet, rppt, surenb, mhocko, hannes, baohua,
	shakeel.butt, riel, ziy, laoar.shao, dev.jain, baolin.wang,
	npache, lorenzo.stoakes, Liam.Howlett, ryan.roberts, vbabka,
	jannh, Arnd Bergmann, sj, linux-kernel, linux-doc, kernel-team,
	Usama Arif

This will allow individual processes to opt-out of THP = "always"
into THP = "madvise", without affecting other workloads on the system.
This has been extensively discussed on the mailing list and has been
summarized very well by David in the first patch which also includes
the links to alternatives, please refer to the first patch commit message
for the motivation for this series.

Patch 1 adds the PR_THP_DISABLE_EXCEPT_ADVISED flag to implement this, along
with the MMF changes.
Patch 2 is a cleanup patch for tva_flags that will allow the forced collapse
case to be transmitted to vma_thp_disabled (which is done in patch 3).
Patch 4 adds documentation for PR_SET_THP_DISABLE/PR_GET_THP_DISABLE.
Patches 6-7 implement the selftests for PR_SET_THP_DISABLE for completely
disabling THPs (old behaviour) and only enabling it at advise
(PR_THP_DISABLE_EXCEPT_ADVISED).

The patches are tested on top of 694c8e78f486b09137ee3efadae044d01aba971b
from mm-new.

v4 -> v5: https://lore.kernel.org/all/20250813135642.1986480-1-usamaarif642@gmail.com/
- small comment fix up in patch 4 (Zi Yan)
- Remove mention of VM_HUGEPAGE and other small fixes in transhuge.rst (Zi)
- add testcases for MADV_NOHUGEPAGE (Lorenzo)

v3 -> v4: https://lore.kernel.org/all/20250804154317.1648084-1-usamaarif642@gmail.com/
- rebase to latest mm-new (Aug 13), which includes the mm flag changes from Lonrenzo.
- remove mention of MM flags from admin doc in transhuge.rst and other other
  improvements to it (David and Lorenzo)
- extract size2ord into vm_util.h (David)
- check if the respective prctl can be set in the fixture setup instead of the fixture
  itself (David)

v2 -> v3: https://lore.kernel.org/all/20250731122825.2102184-1-usamaarif642@gmail.com/
- Fix sign off and added ack for patch 1 (Lorenzo and Zi Yan)
- Fix up commit message, comments and variable names in patch 2 and 3 (Lorenzo)
- Added documentation for PR_SET_THP_DISABLE/PR_GET_THP_DISABLE (Lorenzo)
- remove struct test_results and enum thp_policy for prctl tests (David)

v1 -> v2: https://lore.kernel.org/all/20250725162258.1043176-1-usamaarif642@gmail.com/
- Change thp_push_settings to thp_write_settings (David)
- Add tests for all the system policies for the prctl call (David)
- Small fixes and cleanups

David Hildenbrand (3):
  prctl: extend PR_SET_THP_DISABLE to optionally exclude VM_HUGEPAGE
  mm/huge_memory: convert "tva_flags" to "enum tva_type"
  mm/huge_memory: respect MADV_COLLAPSE with
    PR_THP_DISABLE_EXCEPT_ADVISED

Usama Arif (4):
  docs: transhuge: document process level THP controls
  selftest/mm: Extract sz2ord function into vm_util.h
  selftests: prctl: introduce tests for disabling THPs completely
  selftests: prctl: introduce tests for disabling THPs except for
    madvise

 Documentation/admin-guide/mm/transhuge.rst    |  36 +++
 Documentation/filesystems/proc.rst            |   5 +-
 fs/proc/array.c                               |   2 +-
 fs/proc/task_mmu.c                            |   4 +-
 include/linux/huge_mm.h                       |  60 ++--
 include/linux/mm_types.h                      |  14 +-
 include/uapi/linux/prctl.h                    |  10 +
 kernel/sys.c                                  |  59 +++-
 mm/huge_memory.c                              |  11 +-
 mm/khugepaged.c                               |  19 +-
 mm/memory.c                                   |  20 +-
 mm/shmem.c                                    |   2 +-
 tools/testing/selftests/mm/.gitignore         |   1 +
 tools/testing/selftests/mm/Makefile           |   1 +
 tools/testing/selftests/mm/cow.c              |  12 +-
 .../testing/selftests/mm/prctl_thp_disable.c  | 286 ++++++++++++++++++
 tools/testing/selftests/mm/thp_settings.c     |   9 +-
 tools/testing/selftests/mm/thp_settings.h     |   1 +
 tools/testing/selftests/mm/uffd-wp-mremap.c   |   9 +-
 tools/testing/selftests/mm/vm_util.h          |   5 +
 20 files changed, 480 insertions(+), 86 deletions(-)
 create mode 100644 tools/testing/selftests/mm/prctl_thp_disable.c

-- 
2.47.3


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2025-08-18 13:06 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-15 13:54 [PATCH v5 0/7] prctl: extend PR_SET_THP_DISABLE to only provide THPs when advised Usama Arif
2025-08-15 13:54 ` [PATCH v5 1/7] prctl: extend PR_SET_THP_DISABLE to optionally exclude VM_HUGEPAGE Usama Arif
2025-08-15 13:54 ` [PATCH v5 2/7] mm/huge_memory: convert "tva_flags" to "enum tva_type" Usama Arif
2025-08-15 13:54 ` [PATCH v5 3/7] mm/huge_memory: respect MADV_COLLAPSE with PR_THP_DISABLE_EXCEPT_ADVISED Usama Arif
2025-08-15 13:54 ` [PATCH v5 4/7] docs: transhuge: document process level THP controls Usama Arif
2025-08-15 13:54 ` [PATCH v5 5/7] selftest/mm: Extract sz2ord function into vm_util.h Usama Arif
2025-08-16  6:15   ` Andrew Morton
2025-08-16  6:24     ` David Hildenbrand
2025-08-15 13:54 ` [PATCH v5 6/7] selftests: prctl: introduce tests for disabling THPs completely Usama Arif
2025-08-18  9:36   ` David Hildenbrand
2025-08-18 10:43     ` Usama Arif
2025-08-18 10:41   ` Usama Arif
2025-08-15 13:54 ` [PATCH v5 7/7] selftests: prctl: introduce tests for disabling THPs except for madvise Usama Arif
2025-08-18 10:42   ` Usama Arif
2025-08-18 13:06   ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).