aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/pgtable-3level.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include/asm/pgtable-3level.h')
-rw-r--r--arch/x86/include/asm/pgtable-3level.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
index cdaa58c9b39e..8f50fb3f04e1 100644
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -121,6 +121,12 @@ static inline void native_pmd_clear(pmd_t *pmd)
121 *(tmp + 1) = 0; 121 *(tmp + 1) = 0;
122} 122}
123 123
124#ifndef CONFIG_SMP
125static inline void native_pud_clear(pud_t *pudp)
126{
127}
128#endif
129
124static inline void pud_clear(pud_t *pudp) 130static inline void pud_clear(pud_t *pudp)
125{ 131{
126 set_pud(pudp, __pud(0)); 132 set_pud(pudp, __pud(0));
@@ -176,6 +182,30 @@ 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) 182#define native_pmdp_get_and_clear(xp) native_local_pmdp_get_and_clear(xp)
177#endif 183#endif
178 184
185#ifdef CONFIG_SMP
186union split_pud {
187 struct {
188 u32 pud_low;
189 u32 pud_high;
190 };
191 pud_t pud;
192};
193
194static inline pud_t native_pudp_get_and_clear(pud_t *pudp)
195{
196 union split_pud res, *orig = (union split_pud *)pudp;
197
198 /* xchg acts as a barrier before setting of the high bits */
199 res.pud_low = xchg(&orig->pud_low, 0);
200 res.pud_high = orig->pud_high;
201 orig->pud_high = 0;
202
203 return res.pud;
204}
205#else
206#define native_pudp_get_and_clear(xp) native_local_pudp_get_and_clear(xp)
207#endif
208
179/* Encode and de-code a swap entry */ 209/* Encode and de-code a swap entry */
180#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > 5) 210#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > 5)
181#define __swp_type(x) (((x).val) & 0x1f) 211#define __swp_type(x) (((x).val) & 0x1f)