[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220624215712.3050672-5-song@kernel.org>
Date: Fri, 24 Jun 2022 14:57:11 -0700
From: Song Liu <song@...nel.org>
To: <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
<x86@...r.kernel.org>
CC: <dave.hansen@...ux.intel.com>, <mcgrof@...nel.org>,
<rick.p.edgecombe@...el.com>, <kernel-team@...com>,
<daniel@...earbox.net>, Song Liu <song@...nel.org>
Subject: [PATCH v5 bpf-next 4/5] vmalloc: introduce huge_vmalloc_supported
huge_vmalloc_supported() exposes vmap_allow_huge so that users of vmalloc
APIs could know whether vmalloc will return huge pages.
Suggested-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
Signed-off-by: Song Liu <song@...nel.org>
---
include/linux/vmalloc.h | 6 ++++++
mm/vmalloc.c | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 59d3e1f3e108..aa2182959fc5 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -243,11 +243,17 @@ static inline void set_vm_flush_reset_perms(void *addr)
if (vm)
vm->flags |= VM_FLUSH_RESET_PERMS;
}
+bool huge_vmalloc_supported(void);
#else
static inline void set_vm_flush_reset_perms(void *addr)
{
}
+
+static inline bool huge_vmalloc_supported(void)
+{
+ return false;
+}
#endif
/* for /proc/kcore */
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index effd1ff6a4b4..0a5add4b5b2d 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -72,6 +72,11 @@ early_param("nohugevmalloc", set_nohugevmalloc);
static const bool vmap_allow_huge = false;
#endif /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
+bool huge_vmalloc_supported(void)
+{
+ return vmap_allow_huge;
+}
+
bool is_vmalloc_addr(const void *x)
{
unsigned long addr = (unsigned long)kasan_reset_tag(x);
--
2.30.2
Powered by blists - more mailing lists