diff options
author | Rik van Riel <riel@redhat.com> | 2012-10-09 09:31:12 -0400 |
---|---|---|
committer | Mel Gorman <mgorman@suse.de> | 2012-12-11 09:28:34 -0500 |
commit | 2c3cf556b2f7ab5823195766eddec6f1a43134f5 (patch) | |
tree | ed36a604ac7e629e4eb7c36eda1560ba5b19df59 | |
parent | cef23d9db6b76732d9b0933cb162358a6a1f43d7 (diff) |
x86/mm: Introduce pte_accessible()
We need pte_present to return true for _PAGE_PROTNONE pages, to indicate that
the pte is associated with a page.
However, for TLB flushing purposes, we would like to know whether the pte
points to an actually accessible page. This allows us to skip remote TLB
flushes for pages that are not actually accessible.
Fill in this method for x86 and provide a safe (but slower) method
on other architectures.
Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Fixed-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-66p11te4uj23gevgh4j987ip@git.kernel.org
[ Added Linus's review fixes. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/include/asm/pgtable.h | 6 | ||||
-rw-r--r-- | include/asm-generic/pgtable.h | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index a1f780d45f76..5fe03aaca92e 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -407,6 +407,12 @@ static inline int pte_present(pte_t a) | |||
407 | return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE); | 407 | return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE); |
408 | } | 408 | } |
409 | 409 | ||
410 | #define pte_accessible pte_accessible | ||
411 | static inline int pte_accessible(pte_t a) | ||
412 | { | ||
413 | return pte_flags(a) & _PAGE_PRESENT; | ||
414 | } | ||
415 | |||
410 | static inline int pte_hidden(pte_t pte) | 416 | static inline int pte_hidden(pte_t pte) |
411 | { | 417 | { |
412 | return pte_flags(pte) & _PAGE_HIDDEN; | 418 | return pte_flags(pte) & _PAGE_HIDDEN; |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index b36ce40bd1c6..48fc1dc1c74b 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -219,6 +219,10 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b) | |||
219 | #define move_pte(pte, prot, old_addr, new_addr) (pte) | 219 | #define move_pte(pte, prot, old_addr, new_addr) (pte) |
220 | #endif | 220 | #endif |
221 | 221 | ||
222 | #ifndef pte_accessible | ||
223 | # define pte_accessible(pte) ((void)(pte),1) | ||
224 | #endif | ||
225 | |||
222 | #ifndef flush_tlb_fix_spurious_fault | 226 | #ifndef flush_tlb_fix_spurious_fault |
223 | #define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address) | 227 | #define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address) |
224 | #endif | 228 | #endif |