From: Song Liu <song@kernel.org>
To: <linux-mm@kvack.org>, <bpf@vger.kernel.org>, <netdev@vger.kernel.org>
Cc: <ast@kernel.org>, <daniel@iogearbox.net>, <andrii@kernel.org>,
<kernel-team@fb.com>, <akpm@linux-foundation.org>,
<eric.dumazet@gmail.com>, Song Liu <song@kernel.org>
Subject: [PATCH bpf-next 1/2] vmalloc: expose vmap_allow_huge via get_vmap_allow_huge()
Date: Wed, 9 Feb 2022 22:41:07 -0800 [thread overview]
Message-ID: <20220210064108.1095847-2-song@kernel.org> (raw)
In-Reply-To: <20220210064108.1095847-1-song@kernel.org>
Users can use get_vmap_allow_huge() to predict the behavior of vmalloc (or
its variations). Specifically, if get_vmap_allow_huge() == false, vmalloc
will never return huge pages.
Signed-off-by: Song Liu <song@kernel.org>
---
include/linux/vmalloc.h | 1 +
mm/vmalloc.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 880227b9f044..22acfcd2d0d1 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -256,6 +256,7 @@ extern long vread(char *buf, char *addr, unsigned long count);
extern struct list_head vmap_area_list;
extern __init void vm_area_add_early(struct vm_struct *vm);
extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
+extern bool get_vmap_allow_huge(void);
#ifdef CONFIG_SMP
# ifdef CONFIG_MMU
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 4165304d3547..895ac81b6bb4 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 get_vmap_allow_huge(void)
+{
+ return vmap_allow_huge;
+}
+
bool is_vmalloc_addr(const void *x)
{
unsigned long addr = (unsigned long)x;
--
2.30.2
next prev parent reply other threads:[~2022-02-10 6:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 6:41 [PATCH bpf-next 0/2] flexible size for bpf_prog_pack Song Liu
2022-02-10 6:41 ` Song Liu [this message]
2022-02-10 6:41 ` [PATCH bpf-next 2/2] bpf: " Song Liu
[not found] ` <34d0ed40-30cf-a1a2-f4eb-fa3d0a55bce8@iogearbox.net>
2022-02-10 16:51 ` Song Liu
[not found] ` <dd6dee71-94d7-5393-8fe6-c667938ebfac@iogearbox.net>
2022-02-11 19:42 ` Song Liu
2022-03-01 23:01 ` Song Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220210064108.1095847-2-song@kernel.org \
--to=song@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eric.dumazet@gmail.com \
--cc=kernel-team@fb.com \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).