Skip to contentSkip to conversation

sparc64: Define pte_accessible()

PATCH In review David Miller 2 participants 2 messages Dec 19, 2012 – Dec 20, 2012 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 1/1 sparc64: Define pte_accessible()

We can elide flush_tlb_*() calls when _PAGE_VALID is clear as that is the test used to determine whether or not to queue up a TLB flush in set_pte_at().

---
 arch/sparc/include/asm/pgtable_64.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/sparc/include/asm/pgtable_64.h +7 -1
index 95515f1..7870be0 100644
@@ -617,6 +617,12 @@ static inline unsigned long pte_present(pte_t pte)
 	return val;
 }
 
+#define pte_accessible pte_accessible
+static inline unsigned long pte_accessible(pte_t a)
+{
+	return pte_val(a) & _PAGE_VALID;
+}
+
 static inline unsigned long pte_special(pte_t pte)
 {
 	return pte_val(pte) & _PAGE_SPECIAL;
@@ -802,7 +808,7 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
 	 * SUN4V NOTE: _PAGE_VALID is the same value in both the SUN4U
 	 *             and SUN4V pte layout, so this inline test is fine.
 	 */
-	if (likely(mm != &init_mm) && (pte_val(orig) & _PAGE_VALID))
+	if (likely(mm != &init_mm) && pte_accessible(orig))
 		tlb_batch_add(mm, addr, ptep, orig, fullmm);
 }
 
Signature · 1 line
1.7.12.2.dirty
#1 lore raw
Quoted 4 lines · David Miller

We can elide flush_tlb_*() calls when _PAGE_VALID is clear as that is the test used to determine whether or not to queue up a TLB flush in set_pte_at().

I was a bit puzzeled about this change until I noticed this is an override. And we use pte_accessible in generic code.

Quoted 24 lines
---
 arch/sparc/include/asm/pgtable_64.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/sparc/include/asm/pgtable_64.h +6 -0
index 95515f1..7870be0 100644
@@ -617,6 +617,12 @@ static inline unsigned long pte_present(pte_t pte)
 	return val;
 }
 
+#define pte_accessible pte_accessible
+static inline unsigned long pte_accessible(pte_t a)
+{
+	return pte_val(a) & _PAGE_VALID;
+}
+
 static inline unsigned long pte_special(pte_t pte)
 {
 	return pte_val(pte) & _PAGE_SPECIAL;

arch/sparc/include/asm/pgtable_64.h static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, · line 810

Quoted 3 lines
arch/sparc/include/asm/pgtable_64.h +0 -0
@@ -802,7 +808,7 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
 	 * SUN4V NOTE: _PAGE_VALID is the same value in both the SUN4U
 	 *             and SUN4V pte layout, so this inline test is fine.
 	 */

The comment above belongs to the pte_accessible function now.

arch/sparc/include/asm/pgtable_64.h static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, · line 813

Quoted 4 lines
arch/sparc/include/asm/pgtable_64.h +1 -1
-	if (likely(mm != &init_mm) && (pte_val(orig) & _PAGE_VALID))
+	if (likely(mm != &init_mm) && pte_accessible(orig))
 		tlb_batch_add(mm, addr, ptep, orig, fullmm);
 }

Sam