[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c7eeac93-3619-4443-896f-ef2e02f0bef0@redhat.com>
Date: Thu, 14 Nov 2024 09:04:48 +0100
From: David Hildenbrand <david@...hat.com>
To: Qi Zheng <zhengqi.arch@...edance.com>, jannh@...gle.com,
hughd@...gle.com, willy@...radead.org, muchun.song@...ux.dev,
vbabka@...nel.org, akpm@...ux-foundation.org, peterx@...hat.com
Cc: mgorman@...e.de, catalin.marinas@....com, will@...nel.org,
dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
x86@...nel.org, lorenzo.stoakes@...cle.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, zokeefe@...gle.com, rientjes@...gle.com
Subject: Re: [PATCH v3 4/9] mm: introduce skip_none_ptes()
> static unsigned long zap_pte_range(struct mmu_gather *tlb,
> struct vm_area_struct *vma, pmd_t *pmd,
> unsigned long addr, unsigned long end,
> @@ -1682,13 +1704,17 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
> pte_t ptent = ptep_get(pte);
> int max_nr;
>
> - nr = 1;
> - if (pte_none(ptent))
> - continue;
> -
> if (need_resched())
> break;
>
> + nr = skip_none_ptes(pte, addr, end);
> + if (nr) {
> + addr += PAGE_SIZE * nr;
> + if (addr == end)
> + break;
> + pte += nr;
> + }
> +
> max_nr = (end - addr) / PAGE_SIZE;
I dislike calculating max_nr twice, once here and once in skip_non_ptes.
Further, you're missing to update ptent here. If you inline it you can
avoid another ptep_get().
> if (pte_present(ptent)) {
> nr = zap_present_ptes(tlb, vma, pte, ptent, max_nr,
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists