Commit fb396bb4 authored by Anshuman Khandual's avatar Anshuman Khandual Committed by Catalin Marinas

arm64/hugetlb: Drop TLB flush from get_clear_flush()

This drops now redundant TLB flush in get_clear_flush() which is no longer
required after recent commit 697a1d44 ("tlb: hugetlb: Add more sizes to
tlb_remove_huge_tlb_entry"). It also renames this function i.e dropping off
'_flush' and replacing it with '__contig' as appropriate.

Cc: Will Deacon <will@kernel.org>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
Link: https://lore.kernel.org/r/20220510043930.2410985-1-anshuman.khandual@arm.comSigned-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 710c8d6c
...@@ -166,15 +166,14 @@ static inline int num_contig_ptes(unsigned long size, size_t *pgsize) ...@@ -166,15 +166,14 @@ static inline int num_contig_ptes(unsigned long size, size_t *pgsize)
* *
* This helper performs the break step. * This helper performs the break step.
*/ */
static pte_t get_clear_flush(struct mm_struct *mm, static pte_t get_clear_contig(struct mm_struct *mm,
unsigned long addr, unsigned long addr,
pte_t *ptep, pte_t *ptep,
unsigned long pgsize, unsigned long pgsize,
unsigned long ncontig) unsigned long ncontig)
{ {
pte_t orig_pte = huge_ptep_get(ptep); pte_t orig_pte = huge_ptep_get(ptep);
bool valid = pte_valid(orig_pte); unsigned long i;
unsigned long i, saddr = addr;
for (i = 0; i < ncontig; i++, addr += pgsize, ptep++) { for (i = 0; i < ncontig; i++, addr += pgsize, ptep++) {
pte_t pte = ptep_get_and_clear(mm, addr, ptep); pte_t pte = ptep_get_and_clear(mm, addr, ptep);
...@@ -190,11 +189,6 @@ static pte_t get_clear_flush(struct mm_struct *mm, ...@@ -190,11 +189,6 @@ static pte_t get_clear_flush(struct mm_struct *mm,
if (pte_young(pte)) if (pte_young(pte))
orig_pte = pte_mkyoung(orig_pte); orig_pte = pte_mkyoung(orig_pte);
} }
if (valid) {
struct vm_area_struct vma = TLB_FLUSH_VMA(mm, 0);
flush_tlb_range(&vma, saddr, addr);
}
return orig_pte; return orig_pte;
} }
...@@ -392,7 +386,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, ...@@ -392,7 +386,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
ncontig = find_num_contig(mm, addr, ptep, &pgsize); ncontig = find_num_contig(mm, addr, ptep, &pgsize);
return get_clear_flush(mm, addr, ptep, pgsize, ncontig); return get_clear_contig(mm, addr, ptep, pgsize, ncontig);
} }
/* /*
...@@ -443,7 +437,7 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma, ...@@ -443,7 +437,7 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma,
if (!__cont_access_flags_changed(ptep, pte, ncontig)) if (!__cont_access_flags_changed(ptep, pte, ncontig))
return 0; return 0;
orig_pte = get_clear_flush(vma->vm_mm, addr, ptep, pgsize, ncontig); orig_pte = get_clear_contig(vma->vm_mm, addr, ptep, pgsize, ncontig);
/* Make sure we don't lose the dirty or young state */ /* Make sure we don't lose the dirty or young state */
if (pte_dirty(orig_pte)) if (pte_dirty(orig_pte))
...@@ -476,7 +470,7 @@ void huge_ptep_set_wrprotect(struct mm_struct *mm, ...@@ -476,7 +470,7 @@ void huge_ptep_set_wrprotect(struct mm_struct *mm,
ncontig = find_num_contig(mm, addr, ptep, &pgsize); ncontig = find_num_contig(mm, addr, ptep, &pgsize);
dpfn = pgsize >> PAGE_SHIFT; dpfn = pgsize >> PAGE_SHIFT;
pte = get_clear_flush(mm, addr, ptep, pgsize, ncontig); pte = get_clear_contig(mm, addr, ptep, pgsize, ncontig);
pte = pte_wrprotect(pte); pte = pte_wrprotect(pte);
hugeprot = pte_pgprot(pte); hugeprot = pte_pgprot(pte);
......
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