[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea5b3a3f-9eaa-4335-b0ad-fb1a66a3149b@gmail.com>
Date: Wed, 7 May 2025 16:02:44 +0100
From: Usama Arif <usamaarif642@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>, david@...hat.com,
linux-mm@...ck.org
Cc: hannes@...xchg.org, shakeel.butt@...ux.dev, riel@...riel.com,
ziy@...dia.com, baolin.wang@...ux.alibaba.com, lorenzo.stoakes@...cle.com,
Liam.Howlett@...cle.com, npache@...hat.com, ryan.roberts@....com,
linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH 1/1] prctl: allow overriding system THP policy to always
per process
On 07/05/2025 15:00, Usama Arif wrote:
> Allowing override of global THP policy per process allows workloads
> that have shown to benefit from hugepages to do so, without regressing
> workloads that wouldn't benefit. This will allow such types of workloads
> to be run/stacked on the same machine.
>
> It also helps in rolling out hugepages in hyperscaler configurations
> for workloads that benefit from them, where a single THP policy is likely
> to be used across the entire fleet, and prctl will help override it.
>
> Signed-off-by: Usama Arif <usamaarif642@...il.com>
> ---
> include/linux/huge_mm.h | 3 ++-
> include/linux/mm_types.h | 7 ++-----
> include/uapi/linux/prctl.h | 3 +++
> kernel/sys.c | 16 ++++++++++++++++
> tools/include/uapi/linux/prctl.h | 3 +++
> .../perf/trace/beauty/include/uapi/linux/prctl.h | 3 +++
> 6 files changed, 29 insertions(+), 6 deletions(-)
>
I forgot to include the change for non-anon VMA, which Johannes pointed out (Thanks!)
The patch will require the below fixlet on top of it:
>From b719cd28ae78de699c0f801a4283449f6ac767ad Mon Sep 17 00:00:00 2001
From: Usama Arif <usamaarif642@...il.com>
Date: Wed, 7 May 2025 15:58:39 +0100
Subject: [PATCH] prctl: Allowing override of global THP policy per process
This is a fixlet for doing it for non-anon VMAs as well.
Signed-off-by: Usama Arif <usamaarif642@...il.com>
---
mm/huge_memory.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 2780a12b25f0..c4bf8eae420c 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -177,7 +177,8 @@ unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma,
*/
if (enforce_sysfs &&
(!hugepage_global_enabled() || (!(vm_flags & VM_HUGEPAGE) &&
- !hugepage_global_always())))
+ !hugepage_global_always()) ||
+ test_bit(MMF_THP_ALWAYS, &vma->vm_mm->flags)))
return 0;
/*
--
2.47.1
Powered by blists - more mailing lists