Skip to content

Commit

Permalink
x86: implement pte_special
Browse files Browse the repository at this point in the history
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).

[[email protected]: fix a BUG]
Signed-off-by: Nick Piggin <[email protected]>
Cc: Dave Kleikamp <[email protected]>
Cc: Andy Whitcroft <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Dave Kleikamp <[email protected]>
Cc: Badari Pulavarty <[email protected]>
Cc: Zach Brown <[email protected]>
Cc: Jens Axboe <[email protected]>
Reviewed-by: Peter Zijlstra <[email protected]>
Signed-off-by: Hugh Dickins <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Nick Piggin authored and torvalds committed Jul 26, 2008
1 parent 2682497 commit a0a8f53
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions include/asm-x86/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define _PAGE_BIT_UNUSED2 10
#define _PAGE_BIT_UNUSED3 11
#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */
#define _PAGE_BIT_SPECIAL _PAGE_BIT_UNUSED1
#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */

#define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT)
Expand All @@ -34,6 +35,8 @@
#define _PAGE_UNUSED3 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED3)
#define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT)
#define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE)
#define _PAGE_SPECIAL (_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL)
#define __HAVE_ARCH_PTE_SPECIAL

#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
#define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX)
Expand All @@ -54,7 +57,7 @@

/* Set of bits not changed in pte_modify */
#define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \
_PAGE_ACCESSED | _PAGE_DIRTY)
_PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY)

#define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT)
#define _PAGE_CACHE_WB (0)
Expand Down Expand Up @@ -180,7 +183,7 @@ static inline int pte_exec(pte_t pte)

static inline int pte_special(pte_t pte)
{
return 0;
return pte_val(pte) & _PAGE_SPECIAL;
}

static inline int pmd_large(pmd_t pte)
Expand Down Expand Up @@ -246,7 +249,7 @@ static inline pte_t pte_clrglobal(pte_t pte)

static inline pte_t pte_mkspecial(pte_t pte)
{
return pte;
return __pte(pte_val(pte) | _PAGE_SPECIAL);
}

extern pteval_t __supported_pte_mask;
Expand Down

0 comments on commit a0a8f53

Please sign in to comment.