On 9/11/23 09:44, Matthew Wilcox wrote: >> static inline void set_ptes(struct mm_struct *mm, unsigned long addr, >> pte_t *ptep, pte_t pte, unsigned int nr) >> { >> pgprot_t prot = pte_pgprot(x); >> unsigned long pfn = pte_pfn(pte); >> >> page_table_check_ptes_set(mm, ptep, pte, nr); >> >> arch_enter_lazy_mmu_mode(); >> for (;;) { >> set_pte(ptep, pte); >> if (--nr == 0) >> break; >> ptep++; >> pfn++; >> pte = pfn_pte(pfn, pgprot); >> } >> arch_leave_lazy_mmu_mode(); >> } >> >> Obviously completely untested. 😄 > After fixing your two typos, this assembles to 176 bytes more code than > my version. Not sure that's great. Heh, only two? ;) Maybe I'm a fool, but 176 bytes of text bloat isn't scaring me off too much. I'd much rather have that than another window into x86 goofiness to maintain. Does that 176 bytes translate into meaningful performance, or is it just a bunch of register bit twiddling that the CPU will sail through?