Skip to content

Commit

Permalink
mm/vmalloc: provide fallback arch huge vmap support functions
Browse files Browse the repository at this point in the history
If an architecture doesn't support a particular page table level as
a huge vmap page size then allow it to skip defining the support
query function.

Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
  • Loading branch information
npiggin authored and intel-lab-lkp committed Feb 2, 2021
1 parent a49f0b1 commit abe869c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
7 changes: 3 additions & 4 deletions arch/arm64/include/asm/vmalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
#include <asm/page.h>

#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
static inline bool arch_vmap_p4d_supported(pgprot_t prot)
{
return false;
}

#define arch_vmap_pud_supported arch_vmap_pud_supported
static inline bool arch_vmap_pud_supported(pgprot_t prot)
{
/*
Expand All @@ -19,11 +16,13 @@ static inline bool arch_vmap_pud_supported(pgprot_t prot)
!IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
}

#define arch_vmap_pmd_supported arch_vmap_pmd_supported
static inline bool arch_vmap_pmd_supported(pgprot_t prot)
{
/* See arch_vmap_pud_supported() */
return !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
}

#endif

#endif /* _ASM_ARM64_VMALLOC_H */
7 changes: 3 additions & 4 deletions arch/powerpc/include/asm/vmalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@
#include <asm/page.h>

#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
static inline bool arch_vmap_p4d_supported(pgprot_t prot)
{
return false;
}

#define arch_vmap_pud_supported arch_vmap_pud_supported
static inline bool arch_vmap_pud_supported(pgprot_t prot)
{
/* HPT does not cope with large pages in the vmalloc area */
return radix_enabled();
}

#define arch_vmap_pmd_supported arch_vmap_pmd_supported
static inline bool arch_vmap_pmd_supported(pgprot_t prot)
{
return radix_enabled();
}

#endif

#endif /* _ASM_POWERPC_VMALLOC_H */
13 changes: 5 additions & 8 deletions arch/x86/include/asm/vmalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,21 @@
#include <asm/pgtable_areas.h>

#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
static inline bool arch_vmap_p4d_supported(pgprot_t prot)
{
return false;
}

#ifdef CONFIG_X86_64
#define arch_vmap_pud_supported arch_vmap_pud_supported
static inline bool arch_vmap_pud_supported(pgprot_t prot)
{
#ifdef CONFIG_X86_64
return boot_cpu_has(X86_FEATURE_GBPAGES);
#else
return false;
#endif
}
#endif

#define arch_vmap_pmd_supported arch_vmap_pmd_supported
static inline bool arch_vmap_pmd_supported(pgprot_t prot)
{
return boot_cpu_has(X86_FEATURE_PSE);
}

#endif

#endif /* _ASM_X86_VMALLOC_H */
24 changes: 20 additions & 4 deletions include/linux/vmalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,26 @@ struct vmap_area {
};
};

#ifndef CONFIG_HAVE_ARCH_HUGE_VMAP
static inline bool arch_vmap_p4d_supported(pgprot_t prot) { return false; }
static inline bool arch_vmap_pud_supported(pgprot_t prot) { return false; }
static inline bool arch_vmap_pmd_supported(pgprot_t prot) { return false; }
/* archs that select HAVE_ARCH_HUGE_VMAP should override one or more of these */
#ifndef arch_vmap_p4d_supported
static inline bool arch_vmap_p4d_supported(pgprot_t prot)
{
return false;
}
#endif

#ifndef arch_vmap_pud_supported
static inline bool arch_vmap_pud_supported(pgprot_t prot)
{
return false;
}
#endif

#ifndef arch_vmap_pmd_supported
static inline bool arch_vmap_pmd_supported(pgprot_t prot)
{
return false;
}
#endif

/*
Expand Down

0 comments on commit abe869c

Please sign in to comment.