Skip to content

Commit

Permalink
mm: Implement no-MMU variant of vmalloc_user_node_flags
Browse files Browse the repository at this point in the history
To fix build with !CONFIG_MMU, implement it for no-MMU configurations as well.

Fixes: fc97022 ("bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY")
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Acked-by: John Fastabend <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
anakryiko authored and Alexei Starovoitov committed Nov 25, 2019
1 parent c431047 commit ed81745
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions mm/nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ void *__vmalloc_node_flags(unsigned long size, int node, gfp_t flags)
return __vmalloc(size, flags, PAGE_KERNEL);
}

void *vmalloc_user(unsigned long size)
static void *__vmalloc_user_flags(unsigned long size, gfp_t flags)
{
void *ret;

ret = __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
ret = __vmalloc(size, flags, PAGE_KERNEL);
if (ret) {
struct vm_area_struct *vma;

Expand All @@ -172,8 +172,19 @@ void *vmalloc_user(unsigned long size)

return ret;
}

void *vmalloc_user(unsigned long size)
{
return __vmalloc_user_flags(size, GFP_KERNEL | __GFP_ZERO);
}
EXPORT_SYMBOL(vmalloc_user);

void *vmalloc_user_node_flags(unsigned long size, int node, gfp_t flags)
{
return __vmalloc_user_flags(size, flags | __GFP_ZERO);
}
EXPORT_SYMBOL(vmalloc_user_node_flags);

struct page *vmalloc_to_page(const void *addr)
{
return virt_to_page(addr);
Expand Down

0 comments on commit ed81745

Please sign in to comment.