#include <linux/export.h>
 #include <linux/kdebug.h>
 #include <linux/ptrace.h>
+#include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <asm/processor.h>
 #ifdef CONFIG_SMP
        printk("SMP ");
 #endif
-#ifdef CONFIG_DEBUG_PAGEALLOC
-       printk("DEBUG_PAGEALLOC");
-#endif
+       if (debug_pagealloc_enabled())
+               printk("DEBUG_PAGEALLOC");
        printk("\n");
        notify_die(DIE_OOPS, str, regs, 0, regs->int_code & 0xffff, SIGSEGV);
        print_modules();
 
                        pgd_populate(&init_mm, pg_dir, pu_dir);
                }
                pu_dir = pud_offset(pg_dir, address);
-#ifndef CONFIG_DEBUG_PAGEALLOC
                if (MACHINE_HAS_EDAT2 && pud_none(*pu_dir) && address &&
-                   !(address & ~PUD_MASK) && (address + PUD_SIZE <= end)) {
+                   !(address & ~PUD_MASK) && (address + PUD_SIZE <= end) &&
+                    !debug_pagealloc_enabled()) {
                        pud_val(*pu_dir) = __pa(address) |
                                _REGION_ENTRY_TYPE_R3 | _REGION3_ENTRY_LARGE |
                                (ro ? _REGION_ENTRY_PROTECT : 0);
                        address += PUD_SIZE;
                        continue;
                }
-#endif
                if (pud_none(*pu_dir)) {
                        pm_dir = vmem_pmd_alloc();
                        if (!pm_dir)
                        pud_populate(&init_mm, pu_dir, pm_dir);
                }
                pm_dir = pmd_offset(pu_dir, address);
-#ifndef CONFIG_DEBUG_PAGEALLOC
                if (MACHINE_HAS_EDAT1 && pmd_none(*pm_dir) && address &&
-                   !(address & ~PMD_MASK) && (address + PMD_SIZE <= end)) {
+                   !(address & ~PMD_MASK) && (address + PMD_SIZE <= end) &&
+                   !debug_pagealloc_enabled()) {
                        pmd_val(*pm_dir) = __pa(address) |
                                _SEGMENT_ENTRY | _SEGMENT_ENTRY_LARGE |
                                _SEGMENT_ENTRY_YOUNG |
                        address += PMD_SIZE;
                        continue;
                }
-#endif
                if (pmd_none(*pm_dir)) {
                        pt_dir = vmem_pte_alloc(address);
                        if (!pt_dir)