Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <kirill.shutemov@linux.intel.com>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Howells <dhowells@redhat.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Kirill A. Shutemov and committed by
Linus Torvalds
c07af4f1 cc873177

+10
+2
arch/frv/include/asm/pgtable.h
··· 123 123 #define PGDIR_MASK (~(PGDIR_SIZE - 1)) 124 124 #define PTRS_PER_PGD 64 125 125 126 + #define __PAGETABLE_PUD_FOLDED 126 127 #define PUD_SHIFT 26 127 128 #define PTRS_PER_PUD 1 128 129 #define PUD_SIZE (1UL << PUD_SHIFT) 129 130 #define PUD_MASK (~(PUD_SIZE - 1)) 130 131 #define PUE_SIZE 256 131 132 133 + #define __PAGETABLE_PMD_FOLDED 132 134 #define PMD_SHIFT 26 133 135 #define PMD_SIZE (1UL << PMD_SHIFT) 134 136 #define PMD_MASK (~(PMD_SIZE - 1))
+1
arch/m32r/include/asm/pgtable-2level.h
··· 13 13 * the M32R is two-level, so we don't really have any 14 14 * PMD directory physically. 15 15 */ 16 + #define __PAGETABLE_PMD_FOLDED 16 17 #define PMD_SHIFT 22 17 18 #define PTRS_PER_PMD 1 18 19
+2
arch/m68k/include/asm/pgtable_mm.h
··· 54 54 */ 55 55 #ifdef CONFIG_SUN3 56 56 #define PTRS_PER_PTE 16 57 + #define __PAGETABLE_PMD_FOLDED 57 58 #define PTRS_PER_PMD 1 58 59 #define PTRS_PER_PGD 2048 59 60 #elif defined(CONFIG_COLDFIRE) 60 61 #define PTRS_PER_PTE 512 62 + #define __PAGETABLE_PMD_FOLDED 61 63 #define PTRS_PER_PMD 1 62 64 #define PTRS_PER_PGD 1024 63 65 #else
+2
arch/mn10300/include/asm/pgtable.h
··· 56 56 #define PGDIR_SHIFT 22 57 57 #define PTRS_PER_PGD 1024 58 58 #define PTRS_PER_PUD 1 /* we don't really have any PUD physically */ 59 + #define __PAGETABLE_PUD_FOLDED 59 60 #define PTRS_PER_PMD 1 /* we don't really have any PMD physically */ 61 + #define __PAGETABLE_PMD_FOLDED 60 62 #define PTRS_PER_PTE 1024 61 63 62 64 #define PGD_SIZE PAGE_SIZE
+1
arch/parisc/include/asm/pgtable.h
··· 96 96 #if PT_NLEVELS == 3 97 97 #define BITS_PER_PMD (PAGE_SHIFT + PMD_ORDER - BITS_PER_PMD_ENTRY) 98 98 #else 99 + #define __PAGETABLE_PMD_FOLDED 99 100 #define BITS_PER_PMD 0 100 101 #endif 101 102 #define PTRS_PER_PMD (1UL << BITS_PER_PMD)
+2
arch/s390/include/asm/pgtable.h
··· 91 91 */ 92 92 #define PTRS_PER_PTE 256 93 93 #ifndef CONFIG_64BIT 94 + #define __PAGETABLE_PUD_FOLDED 94 95 #define PTRS_PER_PMD 1 96 + #define __PAGETABLE_PMD_FOLDED 95 97 #define PTRS_PER_PUD 1 96 98 #else /* CONFIG_64BIT */ 97 99 #define PTRS_PER_PMD 2048