On 1/29/24 22:32, David Hildenbrand wrote: > +static inline pte_t get_and_clear_full_ptes(struct mm_struct *mm, > + unsigned long addr, pte_t *ptep, unsigned int nr, int full) > +{ > + pte_t pte, tmp_pte; > + > + pte = ptep_get_and_clear_full(mm, addr, ptep, full); > + while (--nr) { > + ptep++; > + addr += PAGE_SIZE; > + tmp_pte = ptep_get_and_clear_full(mm, addr, ptep, full); > + if (pte_dirty(tmp_pte)) > + pte = pte_mkdirty(pte); > + if (pte_young(tmp_pte)) > + pte = pte_mkyoung(pte); I am wondering whether it's worthy to move the pte_mkdirty() and pte_mkyoung() out of the loop and just do it one time if needed. The worst case is that they are called nr - 1 time. Or it's just too micro? Regards Yin, Fengwei > + } > + return pte; > +}
- Re: [PATCH v1 7/9] mm/mmu_gather: add __tlb_remove_... Ryan Roberts
- Re: [PATCH v1 7/9] mm/mmu_gather: add __tlb_rem... David Hildenbrand
- [PATCH v1 8/9] mm/mmu_gather: add tlb_remove_tlb_entries... David Hildenbrand
- [PATCH v1 9/9] mm/memory: optimize unmap/zap with PTE-ma... David Hildenbrand
- Re: [PATCH v1 9/9] mm/memory: optimize unmap/zap wi... David Hildenbrand
- Re: [PATCH v1 9/9] mm/memory: optimize unmap/zap wi... Ryan Roberts
- Re: [PATCH v1 9/9] mm/memory: optimize unmap/za... David Hildenbrand
- Re: [PATCH v1 9/9] mm/memory: optimize unma... Ryan Roberts
- Re: [PATCH v1 9/9] mm/memory: optimize ... David Hildenbrand
- Re: [PATCH v1 9/9] mm/memory: optimize unmap/zap wi... Yin Fengwei
- Re: [PATCH v1 9/9] mm/memory: optimize unmap/za... David Hildenbrand
- Re: [PATCH v1 9/9] mm/memory: optimize unma... Yin, Fengwei
- Re: [PATCH v1 0/9] mm/memory: optimize unmap/zap with PT... Yin Fengwei
- Re: [PATCH v1 0/9] mm/memory: optimize unmap/zap wi... David Hildenbrand
- Re: [PATCH v1 0/9] mm/memory: optimize unmap/za... Ryan Roberts
- Re: [PATCH v1 0/9] mm/memory: optimize unma... Michal Hocko
- Re: [PATCH v1 0/9] mm/memory: optimize ... David Hildenbrand
- Re: [PATCH v1 0/9] mm/memory: optimize unmap/za... Michal Hocko
- Re: [PATCH v1 0/9] mm/memory: optimize unmap/zap wi... David Hildenbrand