]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
x86/mm: Introduce pte_accessible()
authorRik van Riel <riel@redhat.com>
Tue, 9 Oct 2012 13:31:12 +0000 (15:31 +0200)
committerIngo Molnar <mingo@kernel.org>
Sun, 28 Oct 2012 16:30:55 +0000 (17:30 +0100)
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>
arch/x86/include/asm/pgtable.h
include/asm-generic/pgtable.h

index f85dccd5424ae99771e8d1f080c1335b18b8a20f..a984cf94589a97108a2397d38ca3b2a3ff6e2238 100644 (file)
@@ -408,6 +408,12 @@ static inline int pte_present(pte_t a)
        return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE);
 }
 
+#define pte_accessible pte_accessible
+static inline int pte_accessible(pte_t a)
+{
+       return pte_flags(a) & _PAGE_PRESENT;
+}
+
 static inline int pte_hidden(pte_t pte)
 {
        return pte_flags(pte) & _PAGE_HIDDEN;
index b36ce40bd1c6c929e8b408044440df4ce5931825..48fc1dc1c74b0b54f20300b6107953406af5178c 100644 (file)
@@ -219,6 +219,10 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
 #define move_pte(pte, prot, old_addr, new_addr)        (pte)
 #endif
 
+#ifndef pte_accessible
+# define pte_accessible(pte)           ((void)(pte),1)
+#endif
+
 #ifndef flush_tlb_fix_spurious_fault
 #define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address)
 #endif