powerpc/mm: update radix__ptep_set_access_flag to not do full mm tlb flush
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Mon, 28 Nov 2016 06:17:02 +0000 (11:47 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 28 Nov 2016 11:44:33 +0000 (22:44 +1100)
When we are updating a pte, we just need to flush the tlb mapping
that pte. Right now we do a full mm flush because we don't track the page
size. Now that we have page size details in pte use that to do the
optimized flush

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/book3s/32/pgtable.h
arch/powerpc/include/asm/book3s/64/pgtable.h
arch/powerpc/include/asm/book3s/64/radix.h
arch/powerpc/include/asm/nohash/32/pgtable.h
arch/powerpc/include/asm/nohash/64/pgtable.h
arch/powerpc/mm/pgtable-book3s64.c
arch/powerpc/mm/pgtable.c

index 6b8b2d57fdc8c11851cf8f087898c4c0d24c8e91..dc58980f3ad900e5982c7099ee7079a7afbd6e17 100644 (file)
@@ -224,7 +224,8 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
 
 
 static inline void __ptep_set_access_flags(struct mm_struct *mm,
-                                          pte_t *ptep, pte_t entry)
+                                          pte_t *ptep, pte_t entry,
+                                          unsigned long address)
 {
        unsigned long set = pte_val(entry) &
                (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);
index ac66d05a7c01ce62f348e73294a2b351bafb5580..bbea0040320a2d98c4b323419699dd805c3d3c83 100644 (file)
@@ -578,10 +578,11 @@ static inline bool check_pte_access(unsigned long access, unsigned long ptev)
  */
 
 static inline void __ptep_set_access_flags(struct mm_struct *mm,
-                                          pte_t *ptep, pte_t entry)
+                                          pte_t *ptep, pte_t entry,
+                                          unsigned long address)
 {
        if (radix_enabled())
-               return radix__ptep_set_access_flags(mm, ptep, entry);
+               return radix__ptep_set_access_flags(mm, ptep, entry, address);
        return hash__ptep_set_access_flags(ptep, entry);
 }
 
index d2c5c064e26614f2491072e65ba61a0eb38e219c..36f636911ade98e1d7ad236d094eb7e2ece30f13 100644 (file)
@@ -167,7 +167,8 @@ static inline unsigned long radix__pte_update(struct mm_struct *mm,
  * function doesn't need to invalidate tlb.
  */
 static inline void radix__ptep_set_access_flags(struct mm_struct *mm,
-                                               pte_t *ptep, pte_t entry)
+                                               pte_t *ptep, pte_t entry,
+                                               unsigned long address)
 {
 
        unsigned long set = pte_val(entry) & (_PAGE_DIRTY | _PAGE_ACCESSED |
@@ -183,13 +184,7 @@ static inline void radix__ptep_set_access_flags(struct mm_struct *mm,
                 * new value of pte
                 */
                new_pte = old_pte | set;
-
-               /*
-                * For now let's do heavy pid flush
-                * radix__flush_tlb_page_psize(mm, addr, mmu_virtual_psize);
-                */
-               radix__flush_tlb_mm(mm);
-
+               radix__flush_tlb_pte_p9_dd1(old_pte, mm, address);
                __radix_pte_update(ptep, 0, new_pte);
        } else
                __radix_pte_update(ptep, 0, set);
index c219ef7be53b7f94a616805ce3b39075b8017d66..65073fbc6707c77cd190b47257433c2c18ae0974 100644 (file)
@@ -268,7 +268,8 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
 
 
 static inline void __ptep_set_access_flags(struct mm_struct *mm,
-                                          pte_t *ptep, pte_t entry)
+                                          pte_t *ptep, pte_t entry,
+                                          unsigned long address)
 {
        unsigned long set = pte_val(entry) &
                (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);
index e9e540a804fc02f06b3d6a7b2f77b69e3bdf54bb..53a41b06a7b91ce76f775a726448b3358e0ee907 100644 (file)
@@ -289,7 +289,8 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
  * function doesn't need to flush the hash entry
  */
 static inline void __ptep_set_access_flags(struct mm_struct *mm,
-                                          pte_t *ptep, pte_t entry)
+                                          pte_t *ptep, pte_t entry,
+                                          unsigned long address)
 {
        unsigned long bits = pte_val(entry) &
                (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);
index f4f437cbabf1d44447094e40da48fec9e14eaadc..ebf9782bacf97dffb1a88a71416b7235c840638e 100644 (file)
@@ -35,7 +35,8 @@ int pmdp_set_access_flags(struct vm_area_struct *vma, unsigned long address,
 #endif
        changed = !pmd_same(*(pmdp), entry);
        if (changed) {
-               __ptep_set_access_flags(vma->vm_mm, pmdp_ptep(pmdp), pmd_pte(entry));
+               __ptep_set_access_flags(vma->vm_mm, pmdp_ptep(pmdp),
+                                       pmd_pte(entry), address);
                flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
        }
        return changed;
index 911fdfb63ec1783a89a6400c54fc97c21d6b1c11..cb39c8bd243656727f60b8975c9344766d8d79a9 100644 (file)
@@ -224,7 +224,7 @@ int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address,
        if (changed) {
                if (!is_vm_hugetlb_page(vma))
                        assert_pte_locked(vma->vm_mm, address);
-               __ptep_set_access_flags(vma->vm_mm, ptep, entry);
+               __ptep_set_access_flags(vma->vm_mm, ptep, entry, address);
                flush_tlb_page(vma, address);
        }
        return changed;