#define pr_fmt(fmt) …
#include <linux/gfp.h>
#include <linux/highmem.h>
#include <linux/hugetlb.h>
#include <linux/kernel.h>
#include <linux/kconfig.h>
#include <linux/memblock.h>
#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/mm_types.h>
#include <linux/module.h>
#include <linux/pfn_t.h>
#include <linux/printk.h>
#include <linux/pgtable.h>
#include <linux/random.h>
#include <linux/spinlock.h>
#include <linux/swap.h>
#include <linux/swapops.h>
#include <linux/start_kernel.h>
#include <linux/sched/mm.h>
#include <linux/io.h>
#include <linux/vmalloc.h>
#include <asm/cacheflush.h>
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>
#define RANDOM_NZVALUE …
struct pgtable_debug_args { … };
static void __init pte_basic_tests(struct pgtable_debug_args *args, int idx)
{ … }
static void __init pte_advanced_tests(struct pgtable_debug_args *args)
{ … }
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
static void __init pmd_basic_tests(struct pgtable_debug_args *args, int idx)
{ … }
static void __init pmd_advanced_tests(struct pgtable_debug_args *args)
{ … }
static void __init pmd_leaf_tests(struct pgtable_debug_args *args)
{ … }
#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx)
{ … }
static void __init pud_advanced_tests(struct pgtable_debug_args *args)
{ … }
static void __init pud_leaf_tests(struct pgtable_debug_args *args)
{ … }
#else
static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx) { }
static void __init pud_advanced_tests(struct pgtable_debug_args *args) { }
static void __init pud_leaf_tests(struct pgtable_debug_args *args) { }
#endif
#else
static void __init pmd_basic_tests(struct pgtable_debug_args *args, int idx) { }
static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx) { }
static void __init pmd_advanced_tests(struct pgtable_debug_args *args) { }
static void __init pud_advanced_tests(struct pgtable_debug_args *args) { }
static void __init pmd_leaf_tests(struct pgtable_debug_args *args) { }
static void __init pud_leaf_tests(struct pgtable_debug_args *args) { }
#endif
#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
static void __init pmd_huge_tests(struct pgtable_debug_args *args)
{ … }
static void __init pud_huge_tests(struct pgtable_debug_args *args)
{ … }
#else
static void __init pmd_huge_tests(struct pgtable_debug_args *args) { }
static void __init pud_huge_tests(struct pgtable_debug_args *args) { }
#endif
static void __init p4d_basic_tests(struct pgtable_debug_args *args)
{ … }
static void __init pgd_basic_tests(struct pgtable_debug_args *args)
{ … }
#ifndef __PAGETABLE_PUD_FOLDED
static void __init pud_clear_tests(struct pgtable_debug_args *args)
{ … }
static void __init pud_populate_tests(struct pgtable_debug_args *args)
{ … }
#else
static void __init pud_clear_tests(struct pgtable_debug_args *args) { }
static void __init pud_populate_tests(struct pgtable_debug_args *args) { }
#endif
#ifndef __PAGETABLE_P4D_FOLDED
static void __init p4d_clear_tests(struct pgtable_debug_args *args)
{ … }
static void __init p4d_populate_tests(struct pgtable_debug_args *args)
{ … }
static void __init pgd_clear_tests(struct pgtable_debug_args *args)
{ … }
static void __init pgd_populate_tests(struct pgtable_debug_args *args)
{ … }
#else
static void __init p4d_clear_tests(struct pgtable_debug_args *args) { }
static void __init pgd_clear_tests(struct pgtable_debug_args *args) { }
static void __init p4d_populate_tests(struct pgtable_debug_args *args) { }
static void __init pgd_populate_tests(struct pgtable_debug_args *args) { }
#endif
static void __init pte_clear_tests(struct pgtable_debug_args *args)
{ … }
static void __init pmd_clear_tests(struct pgtable_debug_args *args)
{ … }
static void __init pmd_populate_tests(struct pgtable_debug_args *args)
{ … }
static void __init pte_special_tests(struct pgtable_debug_args *args)
{ … }
static void __init pte_protnone_tests(struct pgtable_debug_args *args)
{ … }
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
static void __init pmd_protnone_tests(struct pgtable_debug_args *args)
{ … }
#else
static void __init pmd_protnone_tests(struct pgtable_debug_args *args) { }
#endif
#ifdef CONFIG_ARCH_HAS_PTE_DEVMAP
static void __init pte_devmap_tests(struct pgtable_debug_args *args)
{ … }
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
static void __init pmd_devmap_tests(struct pgtable_debug_args *args)
{ … }
#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
static void __init pud_devmap_tests(struct pgtable_debug_args *args)
{ … }
#else
static void __init pud_devmap_tests(struct pgtable_debug_args *args) { }
#endif
#else
static void __init pmd_devmap_tests(struct pgtable_debug_args *args) { }
static void __init pud_devmap_tests(struct pgtable_debug_args *args) { }
#endif
#else
static void __init pte_devmap_tests(struct pgtable_debug_args *args) { }
static void __init pmd_devmap_tests(struct pgtable_debug_args *args) { }
static void __init pud_devmap_tests(struct pgtable_debug_args *args) { }
#endif
static void __init pte_soft_dirty_tests(struct pgtable_debug_args *args)
{ … }
static void __init pte_swap_soft_dirty_tests(struct pgtable_debug_args *args)
{ … }
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
static void __init pmd_soft_dirty_tests(struct pgtable_debug_args *args)
{ … }
static void __init pmd_swap_soft_dirty_tests(struct pgtable_debug_args *args)
{ … }
#else
static void __init pmd_soft_dirty_tests(struct pgtable_debug_args *args) { }
static void __init pmd_swap_soft_dirty_tests(struct pgtable_debug_args *args) { }
#endif
static void __init pte_swap_exclusive_tests(struct pgtable_debug_args *args)
{ … }
static void __init pte_swap_tests(struct pgtable_debug_args *args)
{ … }
#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
static void __init pmd_swap_tests(struct pgtable_debug_args *args)
{ … }
#else
static void __init pmd_swap_tests(struct pgtable_debug_args *args) { }
#endif
static void __init swap_migration_tests(struct pgtable_debug_args *args)
{ … }
#ifdef CONFIG_HUGETLB_PAGE
static void __init hugetlb_basic_tests(struct pgtable_debug_args *args)
{ … }
#else
static void __init hugetlb_basic_tests(struct pgtable_debug_args *args) { }
#endif
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
static void __init pmd_thp_tests(struct pgtable_debug_args *args)
{ … }
#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
static void __init pud_thp_tests(struct pgtable_debug_args *args)
{ … }
#else
static void __init pud_thp_tests(struct pgtable_debug_args *args) { }
#endif
#else
static void __init pmd_thp_tests(struct pgtable_debug_args *args) { }
static void __init pud_thp_tests(struct pgtable_debug_args *args) { }
#endif
static unsigned long __init get_random_vaddr(void)
{ … }
static void __init destroy_args(struct pgtable_debug_args *args)
{ … }
static struct page * __init
debug_vm_pgtable_alloc_huge_page(struct pgtable_debug_args *args, int order)
{ … }
static void __init phys_align_check(phys_addr_t pstart,
phys_addr_t pend, unsigned long psize,
phys_addr_t *physp, unsigned long *alignp)
{ … }
static void __init init_fixed_pfns(struct pgtable_debug_args *args)
{ … }
static int __init init_args(struct pgtable_debug_args *args)
{ … }
static int __init debug_vm_pgtable(void)
{ … }
late_initcall(debug_vm_pgtable);