mm: add missing __PAGETABLE_{PUD,PMD}_FOLDED defines

Core mm expects __PAGETABLE_{PUD,PMD}_FOLDED to be defined if these page
table levels folded.  Usually, these defines are provided by
<asm-generic/pgtable-nopmd.h> and <asm-generic/pgtable-nopud.h>.

But some architectures fold page table levels in a custom way.  They
need to define these macros themself.  This patch adds missing defines.

The patch fixes mm->nr_pmds underflow and eliminates dead __pmd_alloc()
and __pud_alloc() on architectures without these page table levels.

Signed-off-by: Kirill A. Shutemov <>
Cc: Aaro Koskinen <>
Cc: David Howells <>
Cc: Geert Uytterhoeven <>
Cc: Heiko Carstens <>
Cc: Helge Deller <>
Cc: "James E.J. Bottomley" <>
Cc: Koichi Yasutake <>
Cc: Martin Schwidefsky <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
6 files changed