[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250725162258.1043176-1-usamaarif642@gmail.com>
Date: Fri, 25 Jul 2025 17:22:39 +0100
From: Usama Arif <usamaarif642@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
david@...hat.com,
linux-mm@...ck.org
Cc: linux-fsdevel@...r.kernel.org,
corbet@....net,
rppt@...nel.org,
surenb@...gle.com,
mhocko@...e.com,
hannes@...xchg.org,
baohua@...nel.org,
shakeel.butt@...ux.dev,
riel@...riel.com,
ziy@...dia.com,
laoar.shao@...il.com,
dev.jain@....com,
baolin.wang@...ux.alibaba.com,
npache@...hat.com,
lorenzo.stoakes@...cle.com,
Liam.Howlett@...cle.com,
ryan.roberts@....com,
vbabka@...e.cz,
jannh@...gle.com,
Arnd Bergmann <arnd@...db.de>,
sj@...nel.org,
linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org,
kernel-team@...a.com,
Usama Arif <usamaarif642@...il.com>
Subject: [PATCH 0/5] prctl: extend PR_SET_THP_DISABLE to only provide THPs when advised
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).
Patches 4-5 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 4ad831303eca6ae518c3b3d86838a2a04b90ec41
from mm-new.
David Hildenbrand (3):
prctl: extend PR_SET_THP_DISABLE to optionally exclude VM_HUGEPAGE
mm/huge_memory: convert "tva_flags" to "enum tva_type" for
thp_vma_allowable_order*()
mm/huge_memory: treat MADV_COLLAPSE as an advise with
PR_THP_DISABLE_EXCEPT_ADVISED
Usama Arif (2):
selftests: prctl: introduce tests for disabling THPs completely
selftests: prctl: introduce tests for disabling THPs except for
madvise
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 | 13 +-
include/uapi/linux/prctl.h | 10 +
kernel/sys.c | 58 +++-
mm/huge_memory.c | 11 +-
mm/khugepaged.c | 20 +-
mm/memory.c | 20 +-
mm/shmem.c | 2 +-
tools/testing/selftests/mm/.gitignore | 1 +
tools/testing/selftests/mm/Makefile | 1 +
.../testing/selftests/mm/prctl_thp_disable.c | 257 ++++++++++++++++++
14 files changed, 394 insertions(+), 70 deletions(-)
create mode 100644 tools/testing/selftests/mm/prctl_thp_disable.c
--
2.47.3
Powered by blists - more mailing lists