Re: [PATCH v4 bpf 2/4] page_alloc: use vmalloc_huge for large system hash

From: Linus Torvalds
Date: Mon Apr 25 2022 - 04:18:38 EST


On Mon, Apr 25, 2022 at 12:07 AM Geert Uytterhoeven
<geert@xxxxxxxxxxxxxx> wrote:
>
> vmalloc_huge() is provided by mm/vmalloc.c, which is not
> compiled if CONFIG_MMU=n.

Well, that's annoying.

Does this trivial patch fix it for you?

I get this feeling that this could be done better with a weak alias to
__vmalloc(), and that could take care of the "arch doesn't support
VMAP_HUGE" case too, but the attached is the stupid and
straightforward version.

Linus
mm/nommu.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/mm/nommu.c b/mm/nommu.c
index 55a9e48a7a02..2a655ed56644 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -226,6 +226,11 @@ void *vmalloc(unsigned long size)
}
EXPORT_SYMBOL(vmalloc);

+void *vmalloc_huge(unsigned long size, gfp_t gfp_mask)
+{
+ return __vmalloc(size, gfp_mask);
+}
+
/*
* vzalloc - allocate virtually contiguous memory with zero fill
*