History

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.

Kirill A. Shutemov committed 11 years ago

Commit c07af4f1 parent cc873176 files · +10 −0Browse files

Unified · Split

6 files
  1. arch/frv/include/asm/pgtable.h +2 −0
  2. arch/m32r/include/asm/pgtable-2level.h +1 −0
  3. arch/m68k/include/asm/pgtable_mm.h +2 −0
  4. arch/mn10300/include/asm/pgtable.h +2 −0
  5. arch/parisc/include/asm/pgtable.h +1 −0
  6. arch/s390/include/asm/pgtable.h +2 −0
arch/frv/include/asm/pgtable.h+2−0
@@ -123,12 +123,14 @@ extern unsigned long empty_zero_page; · 122 unmodified lines
123#define PGDIR_MASK (~(PGDIR_SIZE - 1))123#define PGDIR_MASK (~(PGDIR_SIZE - 1))
124#define PTRS_PER_PGD 64124#define PTRS_PER_PGD 64
125 125
126#define __PAGETABLE_PUD_FOLDED
126#define PUD_SHIFT 26127#define PUD_SHIFT 26
127#define PTRS_PER_PUD 1128#define PTRS_PER_PUD 1
128#define PUD_SIZE (1UL << PUD_SHIFT)129#define PUD_SIZE (1UL << PUD_SHIFT)
129#define PUD_MASK (~(PUD_SIZE - 1))130#define PUD_MASK (~(PUD_SIZE - 1))
130#define PUE_SIZE 256131#define PUE_SIZE 256
131 132
133#define __PAGETABLE_PMD_FOLDED
132#define PMD_SHIFT 26134#define PMD_SHIFT 26
133#define PMD_SIZE (1UL << PMD_SHIFT)135#define PMD_SIZE (1UL << PMD_SHIFT)
134#define PMD_MASK (~(PMD_SIZE - 1))136#define PMD_MASK (~(PMD_SIZE - 1))
arch/m32r/include/asm/pgtable-2level.h+1−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
13 * the M32R is two-level, so we don't really have any13 * the M32R is two-level, so we don't really have any
14 * PMD directory physically.14 * PMD directory physically.
15 */15 */
16#define __PAGETABLE_PMD_FOLDED
16#define PMD_SHIFT 2217#define PMD_SHIFT 22
17#define PTRS_PER_PMD 118#define PTRS_PER_PMD 1
18 19
arch/m68k/include/asm/pgtable_mm.h+2−0
@@ -54,10 +54,12 @@ · 53 unmodified lines
54 */54 */
55#ifdef CONFIG_SUN355#ifdef CONFIG_SUN3
56#define PTRS_PER_PTE 1656#define PTRS_PER_PTE 16
57#define __PAGETABLE_PMD_FOLDED
57#define PTRS_PER_PMD 158#define PTRS_PER_PMD 1
58#define PTRS_PER_PGD 204859#define PTRS_PER_PGD 2048
59#elif defined(CONFIG_COLDFIRE)60#elif defined(CONFIG_COLDFIRE)
60#define PTRS_PER_PTE 51261#define PTRS_PER_PTE 512
62#define __PAGETABLE_PMD_FOLDED
61#define PTRS_PER_PMD 163#define PTRS_PER_PMD 1
62#define PTRS_PER_PGD 102464#define PTRS_PER_PGD 1024
63#else65#else
arch/mn10300/include/asm/pgtable.h+2−0
@@ -56,7 +56,9 @@ extern void paging_init(void); · 55 unmodified lines
56#define PGDIR_SHIFT 2256#define PGDIR_SHIFT 22
57#define PTRS_PER_PGD 102457#define PTRS_PER_PGD 1024
58#define PTRS_PER_PUD 1 /* we don't really have any PUD physically */58#define PTRS_PER_PUD 1 /* we don't really have any PUD physically */
59#define __PAGETABLE_PUD_FOLDED
59#define PTRS_PER_PMD 1 /* we don't really have any PMD physically */60#define PTRS_PER_PMD 1 /* we don't really have any PMD physically */
61#define __PAGETABLE_PMD_FOLDED
60#define PTRS_PER_PTE 102462#define PTRS_PER_PTE 1024
61 63
62#define PGD_SIZE PAGE_SIZE64#define PGD_SIZE PAGE_SIZE
arch/parisc/include/asm/pgtable.h+1−0
@@ -96,6 +96,7 @@ extern void purge_tlb_entries(struct mm_struct *, unsigned long); · 95 unmodified lines
96#if PT_NLEVELS == 396#if PT_NLEVELS == 3
97#define BITS_PER_PMD (PAGE_SHIFT + PMD_ORDER - BITS_PER_PMD_ENTRY)97#define BITS_PER_PMD (PAGE_SHIFT + PMD_ORDER - BITS_PER_PMD_ENTRY)
98#else98#else
99#define __PAGETABLE_PMD_FOLDED
99#define BITS_PER_PMD 0100#define BITS_PER_PMD 0
100#endif101#endif
101#define PTRS_PER_PMD (1UL << BITS_PER_PMD)102#define PTRS_PER_PMD (1UL << BITS_PER_PMD)
arch/s390/include/asm/pgtable.h+2−0
@@ -91,7 +91,9 @@ extern unsigned long zero_page_mask; · 90 unmodified lines
91 */91 */
92#define PTRS_PER_PTE 25692#define PTRS_PER_PTE 256
93#ifndef CONFIG_64BIT93#ifndef CONFIG_64BIT
94#define __PAGETABLE_PUD_FOLDED
94#define PTRS_PER_PMD 195#define PTRS_PER_PMD 1
96#define __PAGETABLE_PMD_FOLDED
95#define PTRS_PER_PUD 197#define PTRS_PER_PUD 1
96#else /* CONFIG_64BIT */98#else /* CONFIG_64BIT */
97#define PTRS_PER_PMD 204899#define PTRS_PER_PMD 2048