diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2015-02-10 17:11:22 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-10 17:30:33 -0500 |
commit | 0a191362058391878cc2a4d4ccddcd8223eb4f79 (patch) | |
tree | a61b46f17075ca630b4832d9bbf629911716c7a6 /arch | |
parent | 40171798fe11a6dc1d963058b097b2c4c9d34a9c (diff) |
x86: drop _PAGE_FILE and pte_file()-related helpers
We've replaced remap_file_pages(2) implementation with emulation. Nobody
creates non-linear mapping anymore.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/pgtable-2level.h | 38 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable-3level.h | 12 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable.h | 20 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable_64.h | 6 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable_types.h | 3 |
5 files changed, 2 insertions, 77 deletions
diff --git a/arch/x86/include/asm/pgtable-2level.h b/arch/x86/include/asm/pgtable-2level.h index 206a87fdd22d..fd74a11959de 100644 --- a/arch/x86/include/asm/pgtable-2level.h +++ b/arch/x86/include/asm/pgtable-2level.h | |||
@@ -62,44 +62,8 @@ static inline unsigned long pte_bitop(unsigned long value, unsigned int rightshi | |||
62 | return ((value >> rightshift) & mask) << leftshift; | 62 | return ((value >> rightshift) & mask) << leftshift; |
63 | } | 63 | } |
64 | 64 | ||
65 | /* | ||
66 | * Bits _PAGE_BIT_PRESENT, _PAGE_BIT_FILE and _PAGE_BIT_PROTNONE are taken, | ||
67 | * split up the 29 bits of offset into this range. | ||
68 | */ | ||
69 | #define PTE_FILE_MAX_BITS 29 | ||
70 | #define PTE_FILE_SHIFT1 (_PAGE_BIT_PRESENT + 1) | ||
71 | #define PTE_FILE_SHIFT2 (_PAGE_BIT_FILE + 1) | ||
72 | #define PTE_FILE_SHIFT3 (_PAGE_BIT_PROTNONE + 1) | ||
73 | #define PTE_FILE_BITS1 (PTE_FILE_SHIFT2 - PTE_FILE_SHIFT1 - 1) | ||
74 | #define PTE_FILE_BITS2 (PTE_FILE_SHIFT3 - PTE_FILE_SHIFT2 - 1) | ||
75 | |||
76 | #define PTE_FILE_MASK1 ((1U << PTE_FILE_BITS1) - 1) | ||
77 | #define PTE_FILE_MASK2 ((1U << PTE_FILE_BITS2) - 1) | ||
78 | |||
79 | #define PTE_FILE_LSHIFT2 (PTE_FILE_BITS1) | ||
80 | #define PTE_FILE_LSHIFT3 (PTE_FILE_BITS1 + PTE_FILE_BITS2) | ||
81 | |||
82 | static __always_inline pgoff_t pte_to_pgoff(pte_t pte) | ||
83 | { | ||
84 | return (pgoff_t) | ||
85 | (pte_bitop(pte.pte_low, PTE_FILE_SHIFT1, PTE_FILE_MASK1, 0) + | ||
86 | pte_bitop(pte.pte_low, PTE_FILE_SHIFT2, PTE_FILE_MASK2, PTE_FILE_LSHIFT2) + | ||
87 | pte_bitop(pte.pte_low, PTE_FILE_SHIFT3, -1UL, PTE_FILE_LSHIFT3)); | ||
88 | } | ||
89 | |||
90 | static __always_inline pte_t pgoff_to_pte(pgoff_t off) | ||
91 | { | ||
92 | return (pte_t){ | ||
93 | .pte_low = | ||
94 | pte_bitop(off, 0, PTE_FILE_MASK1, PTE_FILE_SHIFT1) + | ||
95 | pte_bitop(off, PTE_FILE_LSHIFT2, PTE_FILE_MASK2, PTE_FILE_SHIFT2) + | ||
96 | pte_bitop(off, PTE_FILE_LSHIFT3, -1UL, PTE_FILE_SHIFT3) + | ||
97 | _PAGE_FILE, | ||
98 | }; | ||
99 | } | ||
100 | |||
101 | /* Encode and de-code a swap entry */ | 65 | /* Encode and de-code a swap entry */ |
102 | #define SWP_TYPE_BITS (_PAGE_BIT_FILE - _PAGE_BIT_PRESENT - 1) | 66 | #define SWP_TYPE_BITS 5 |
103 | #define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 1) | 67 | #define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 1) |
104 | 68 | ||
105 | #define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS) | 69 | #define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS) |
diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h index 81bb91b49a88..cdaa58c9b39e 100644 --- a/arch/x86/include/asm/pgtable-3level.h +++ b/arch/x86/include/asm/pgtable-3level.h | |||
@@ -176,18 +176,6 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *pmdp) | |||
176 | #define native_pmdp_get_and_clear(xp) native_local_pmdp_get_and_clear(xp) | 176 | #define native_pmdp_get_and_clear(xp) native_local_pmdp_get_and_clear(xp) |
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | /* | ||
180 | * Bits 0, 6 and 7 are taken in the low part of the pte, | ||
181 | * put the 32 bits of offset into the high part. | ||
182 | * | ||
183 | * For soft-dirty tracking 11 bit is taken from | ||
184 | * the low part of pte as well. | ||
185 | */ | ||
186 | #define pte_to_pgoff(pte) ((pte).pte_high) | ||
187 | #define pgoff_to_pte(off) \ | ||
188 | ((pte_t) { { .pte_low = _PAGE_FILE, .pte_high = (off) } }) | ||
189 | #define PTE_FILE_MAX_BITS 32 | ||
190 | |||
191 | /* Encode and de-code a swap entry */ | 179 | /* Encode and de-code a swap entry */ |
192 | #define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > 5) | 180 | #define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > 5) |
193 | #define __swp_type(x) (((x).val) & 0x1f) | 181 | #define __swp_type(x) (((x).val) & 0x1f) |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index e8a5454acc99..0fe03f834fb1 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -115,11 +115,6 @@ static inline int pte_write(pte_t pte) | |||
115 | return pte_flags(pte) & _PAGE_RW; | 115 | return pte_flags(pte) & _PAGE_RW; |
116 | } | 116 | } |
117 | 117 | ||
118 | static inline int pte_file(pte_t pte) | ||
119 | { | ||
120 | return pte_flags(pte) & _PAGE_FILE; | ||
121 | } | ||
122 | |||
123 | static inline int pte_huge(pte_t pte) | 118 | static inline int pte_huge(pte_t pte) |
124 | { | 119 | { |
125 | return pte_flags(pte) & _PAGE_PSE; | 120 | return pte_flags(pte) & _PAGE_PSE; |
@@ -329,21 +324,6 @@ static inline pmd_t pmd_mksoft_dirty(pmd_t pmd) | |||
329 | return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY); | 324 | return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY); |
330 | } | 325 | } |
331 | 326 | ||
332 | static inline pte_t pte_file_clear_soft_dirty(pte_t pte) | ||
333 | { | ||
334 | return pte_clear_flags(pte, _PAGE_SOFT_DIRTY); | ||
335 | } | ||
336 | |||
337 | static inline pte_t pte_file_mksoft_dirty(pte_t pte) | ||
338 | { | ||
339 | return pte_set_flags(pte, _PAGE_SOFT_DIRTY); | ||
340 | } | ||
341 | |||
342 | static inline int pte_file_soft_dirty(pte_t pte) | ||
343 | { | ||
344 | return pte_flags(pte) & _PAGE_SOFT_DIRTY; | ||
345 | } | ||
346 | |||
347 | #endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */ | 327 | #endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */ |
348 | 328 | ||
349 | /* | 329 | /* |
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index 4572b2f30237..e227970f983e 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h | |||
@@ -133,10 +133,6 @@ static inline int pgd_large(pgd_t pgd) { return 0; } | |||
133 | /* PUD - Level3 access */ | 133 | /* PUD - Level3 access */ |
134 | 134 | ||
135 | /* PMD - Level 2 access */ | 135 | /* PMD - Level 2 access */ |
136 | #define pte_to_pgoff(pte) ((pte_val((pte)) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT) | ||
137 | #define pgoff_to_pte(off) ((pte_t) { .pte = ((off) << PAGE_SHIFT) | \ | ||
138 | _PAGE_FILE }) | ||
139 | #define PTE_FILE_MAX_BITS __PHYSICAL_MASK_SHIFT | ||
140 | 136 | ||
141 | /* PTE - Level 1 access. */ | 137 | /* PTE - Level 1 access. */ |
142 | 138 | ||
@@ -145,7 +141,7 @@ static inline int pgd_large(pgd_t pgd) { return 0; } | |||
145 | #define pte_unmap(pte) ((void)(pte))/* NOP */ | 141 | #define pte_unmap(pte) ((void)(pte))/* NOP */ |
146 | 142 | ||
147 | /* Encode and de-code a swap entry */ | 143 | /* Encode and de-code a swap entry */ |
148 | #define SWP_TYPE_BITS (_PAGE_BIT_FILE - _PAGE_BIT_PRESENT - 1) | 144 | #define SWP_TYPE_BITS 5 |
149 | #ifdef CONFIG_NUMA_BALANCING | 145 | #ifdef CONFIG_NUMA_BALANCING |
150 | /* Automatic NUMA balancing needs to be distinguishable from swap entries */ | 146 | /* Automatic NUMA balancing needs to be distinguishable from swap entries */ |
151 | #define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 2) | 147 | #define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 2) |
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index 25bcd4a89517..5185a4f599ec 100644 --- a/arch/x86/include/asm/pgtable_types.h +++ b/arch/x86/include/asm/pgtable_types.h | |||
@@ -38,8 +38,6 @@ | |||
38 | /* If _PAGE_BIT_PRESENT is clear, we use these: */ | 38 | /* If _PAGE_BIT_PRESENT is clear, we use these: */ |
39 | /* - if the user mapped it with PROT_NONE; pte_present gives true */ | 39 | /* - if the user mapped it with PROT_NONE; pte_present gives true */ |
40 | #define _PAGE_BIT_PROTNONE _PAGE_BIT_GLOBAL | 40 | #define _PAGE_BIT_PROTNONE _PAGE_BIT_GLOBAL |
41 | /* - set: nonlinear file mapping, saved PTE; unset:swap */ | ||
42 | #define _PAGE_BIT_FILE _PAGE_BIT_DIRTY | ||
43 | 41 | ||
44 | #define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT) | 42 | #define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT) |
45 | #define _PAGE_RW (_AT(pteval_t, 1) << _PAGE_BIT_RW) | 43 | #define _PAGE_RW (_AT(pteval_t, 1) << _PAGE_BIT_RW) |
@@ -114,7 +112,6 @@ | |||
114 | #define _PAGE_NX (_AT(pteval_t, 0)) | 112 | #define _PAGE_NX (_AT(pteval_t, 0)) |
115 | #endif | 113 | #endif |
116 | 114 | ||
117 | #define _PAGE_FILE (_AT(pteval_t, 1) << _PAGE_BIT_FILE) | ||
118 | #define _PAGE_PROTNONE (_AT(pteval_t, 1) << _PAGE_BIT_PROTNONE) | 115 | #define _PAGE_PROTNONE (_AT(pteval_t, 1) << _PAGE_BIT_PROTNONE) |
119 | 116 | ||
120 | #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \ | 117 | #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \ |