Skip to content

Commit

Permalink
vmalloc: introduce huge_vmalloc_supported
Browse files Browse the repository at this point in the history
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@intel.com>
Signed-off-by: Song Liu <song@kernel.org>
  • Loading branch information
liu-song-6 authored and intel-lab-lkp committed May 19, 2022
1 parent a62834a commit f1d2b40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/linux/vmalloc.h
Expand Up @@ -242,11 +242,13 @@ 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)
{
}
bool huge_vmalloc_supported(void) { return false; }
#endif

/* for /proc/kcore */
Expand Down
5 changes: 5 additions & 0 deletions mm/vmalloc.c
Expand Up @@ -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);
Expand Down

0 comments on commit f1d2b40

Please sign in to comment.