Commit b3603e17 authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Michael Ellerman

powerpc/mm: update radix__ptep_set_access_flag to not do full mm tlb flush

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: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 6d3a0379
...@@ -224,7 +224,8 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, ...@@ -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, 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) & unsigned long set = pte_val(entry) &
(_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC); (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);
......
...@@ -578,10 +578,11 @@ static inline bool check_pte_access(unsigned long access, unsigned long ptev) ...@@ -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, 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()) 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); return hash__ptep_set_access_flags(ptep, entry);
} }
......
...@@ -167,7 +167,8 @@ static inline unsigned long radix__pte_update(struct mm_struct *mm, ...@@ -167,7 +167,8 @@ static inline unsigned long radix__pte_update(struct mm_struct *mm,
* function doesn't need to invalidate tlb. * function doesn't need to invalidate tlb.
*/ */
static inline void radix__ptep_set_access_flags(struct mm_struct *mm, 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 | 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, ...@@ -183,13 +184,7 @@ static inline void radix__ptep_set_access_flags(struct mm_struct *mm,
* new value of pte * new value of pte
*/ */
new_pte = old_pte | set; new_pte = old_pte | set;
radix__flush_tlb_pte_p9_dd1(old_pte, mm, address);
/*
* For now let's do heavy pid flush
* radix__flush_tlb_page_psize(mm, addr, mmu_virtual_psize);
*/
radix__flush_tlb_mm(mm);
__radix_pte_update(ptep, 0, new_pte); __radix_pte_update(ptep, 0, new_pte);
} else } else
__radix_pte_update(ptep, 0, set); __radix_pte_update(ptep, 0, set);
......
...@@ -268,7 +268,8 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, ...@@ -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, 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) & unsigned long set = pte_val(entry) &
(_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC); (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);
......
...@@ -289,7 +289,8 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, ...@@ -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 * function doesn't need to flush the hash entry
*/ */
static inline void __ptep_set_access_flags(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 bits = pte_val(entry) & unsigned long bits = pte_val(entry) &
(_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC); (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);
......
...@@ -35,7 +35,8 @@ int pmdp_set_access_flags(struct vm_area_struct *vma, unsigned long address, ...@@ -35,7 +35,8 @@ int pmdp_set_access_flags(struct vm_area_struct *vma, unsigned long address,
#endif #endif
changed = !pmd_same(*(pmdp), entry); changed = !pmd_same(*(pmdp), entry);
if (changed) { 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); flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
} }
return changed; return changed;
......
...@@ -224,7 +224,7 @@ int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address, ...@@ -224,7 +224,7 @@ int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address,
if (changed) { if (changed) {
if (!is_vm_hugetlb_page(vma)) if (!is_vm_hugetlb_page(vma))
assert_pte_locked(vma->vm_mm, address); 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); flush_tlb_page(vma, address);
} }
return changed; return changed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment