[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3aaf6c2338372866b85cea78140f5ea497ccc33d.1731566457.git.zhengqi.arch@bytedance.com>
Date: Thu, 14 Nov 2024 14:59:57 +0800
From: Qi Zheng <zhengqi.arch@...edance.com>
To: david@...hat.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,
Qi Zheng <zhengqi.arch@...edance.com>
Subject: [PATCH v3 6/9] mm: make zap_pte_range() handle full within-PMD range
In preparation for reclaiming empty PTE pages, this commit first makes
zap_pte_range() to handle the full within-PMD range, so that we can more
easily detect and free PTE pages in this function in subsequent commits.
Signed-off-by: Qi Zheng <zhengqi.arch@...edance.com>
Reviewed-by: Jann Horn <jannh@...gle.com>
---
mm/memory.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mm/memory.c b/mm/memory.c
index bf5ac8e0b4656..8b3348ff374ff 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1711,6 +1711,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
pte_t *pte;
int nr;
+retry:
tlb_change_page_size(tlb, PAGE_SIZE);
init_rss_vec(rss);
start_pte = pte = pte_offset_map_lock(mm, pmd, addr, &ptl);
@@ -1758,6 +1759,13 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
if (force_flush)
tlb_flush_mmu(tlb);
+ if (addr != end) {
+ cond_resched();
+ force_flush = false;
+ force_break = false;
+ goto retry;
+ }
+
return addr;
}
--
2.20.1
Powered by blists - more mailing lists