On Thu, Mar 24, 2022 at 02:35:44PM +0000, Steve Capper wrote: > > It occurs to me that perhaps this can be written like: > > > > unsigned long _sz = huge_page_size(h); > > if (_sz >= P4D_SIZE) > > tlb_flush_p4d_range(tlb, address, _sz); > > else if (_sz >= PUD_SIZE) > > tlb_flush_pud_range(tlb, address, _sz); > > else if (_sz >= PMD_SIZE) > > tlb_flush_pmd_range(tlb, address, _sz); > > else > > tlb_flush_pte_range(tlb, address, _sz); > > __tlb_remove_tlb_entry(tlb, ptep, address); > > > > And then it can still be generic.. > > Thanks Peter, > My concern with that would be the CONT_PMD_SIZE case would result in a call > to tlb_flush_pte_range rather than tlb_flush_pmd_range causing some of the > level parameters to be different. arch/arm64/include/asm/pgtable-hwdef.h:#define CONT_PMD_SIZE (CONT_PMDS * PMD_SIZE) Seems to imply CONT_PMD_SIZE >= PMD_SIZE, and would thus tickle: > > else if (_sz >= PMD_SIZE) > > tlb_flush_pmd_range(tlb, address, _sz); Or am I confused?