[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250506-map-map_stack-to-vm_nohugepage-only-if-thp-is-enabled-v2-2-f11f0c794872@kuka.com>
Date: Tue, 06 May 2025 15:44:33 +0200
From: Ignacio Moreno Gonzalez via B4 Relay <devnull+Ignacio.MorenoGonzalez.kuka.com@...nel.org>
To: lorenzo.stoakes@...cle.com
Cc: Liam.Howlett@...cle.com, akpm@...ux-foundation.org,
yang@...amperecomputing.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Ignacio Moreno Gonzalez <Ignacio.MorenoGonzalez@...a.com>,
Matthew Wilcox <willy@...radead.org>
Subject: [PATCH v2 2/2] mm: madvise: no-op for MADV_NOHUGEPAGE if THP is
disabled
From: Ignacio Moreno Gonzalez <Ignacio.MorenoGonzalez@...a.com>
VM_NOHUGEPAGE is a no-op in a kernel without THP. So it makes no sense
to return an error when calling madvise() with MADV_NOHUGEPAGE.
Suggested-by: Matthew Wilcox <willy@...radead.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Reviewed-by: Yang Shi <yang@...amperecomputing.com>
Signed-off-by: Ignacio Moreno Gonzalez <Ignacio.MorenoGonzalez@...a.com>
---
include/linux/huge_mm.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index e893d546a49f464f7586db639fe216231f03651a..cdb991f9be918182f94003394cf793654a080224 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -7,6 +7,10 @@
#include <linux/fs.h> /* only for vma_is_dax() */
#include <linux/kobject.h>
+#ifndef CONFIG_TRANSPARENT_HUGEPAGE
+#include <uapi/asm-generic/mman-common.h>
+#endif
+
vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf);
int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
@@ -598,6 +602,8 @@ static inline bool unmap_huge_pmd_locked(struct vm_area_struct *vma,
static inline int hugepage_madvise(struct vm_area_struct *vma,
unsigned long *vm_flags, int advice)
{
+ if (advice == MADV_NOHUGEPAGE)
+ return 0;
return -EINVAL;
}
--
2.39.5
Powered by blists - more mailing lists