Commit a0a8f5364a5ad248aec6cb705e0092ff563edc2f
Committed by
Linus Torvalds
1 parent
2682497245
Exists in
master
and in
4 other branches
x86: implement pte_special
Implement the pte_special bit for x86. This is required to support lockless get_user_pages, because we need to know whether or not we can refcount a particular page given only its pte (and no vma). [hugh@veritas.com: fix a BUG] Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: Dave Kleikamp <shaggy@austin.ibm.com> Cc: Andy Whitcroft <apw@shadowen.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Andi Kleen <andi@firstfloor.org> Cc: Dave Kleikamp <shaggy@austin.ibm.com> Cc: Badari Pulavarty <pbadari@us.ibm.com> Cc: Zach Brown <zach.brown@oracle.com> Cc: Jens Axboe <jens.axboe@oracle.com> Reviewed-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 6 additions and 3 deletions Side-by-side Diff
include/asm-x86/pgtable.h
| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | #define _PAGE_BIT_UNUSED2 10 |
| 19 | 19 | #define _PAGE_BIT_UNUSED3 11 |
| 20 | 20 | #define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */ |
| 21 | +#define _PAGE_BIT_SPECIAL _PAGE_BIT_UNUSED1 | |
| 21 | 22 | #define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ |
| 22 | 23 | |
| 23 | 24 | #define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT) |
| ... | ... | @@ -34,6 +35,8 @@ |
| 34 | 35 | #define _PAGE_UNUSED3 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED3) |
| 35 | 36 | #define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT) |
| 36 | 37 | #define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE) |
| 38 | +#define _PAGE_SPECIAL (_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL) | |
| 39 | +#define __HAVE_ARCH_PTE_SPECIAL | |
| 37 | 40 | |
| 38 | 41 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) |
| 39 | 42 | #define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX) |
| ... | ... | @@ -54,7 +57,7 @@ |
| 54 | 57 | |
| 55 | 58 | /* Set of bits not changed in pte_modify */ |
| 56 | 59 | #define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \ |
| 57 | - _PAGE_ACCESSED | _PAGE_DIRTY) | |
| 60 | + _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY) | |
| 58 | 61 | |
| 59 | 62 | #define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT) |
| 60 | 63 | #define _PAGE_CACHE_WB (0) |
| ... | ... | @@ -180,7 +183,7 @@ |
| 180 | 183 | |
| 181 | 184 | static inline int pte_special(pte_t pte) |
| 182 | 185 | { |
| 183 | - return 0; | |
| 186 | + return pte_val(pte) & _PAGE_SPECIAL; | |
| 184 | 187 | } |
| 185 | 188 | |
| 186 | 189 | static inline int pmd_large(pmd_t pte) |
| ... | ... | @@ -246,7 +249,7 @@ |
| 246 | 249 | |
| 247 | 250 | static inline pte_t pte_mkspecial(pte_t pte) |
| 248 | 251 | { |
| 249 | - return pte; | |
| 252 | + return __pte(pte_val(pte) | _PAGE_SPECIAL); | |
| 250 | 253 | } |
| 251 | 254 | |
| 252 | 255 | extern pteval_t __supported_pte_mask; |