Re: [PATCH] mm: mglru: use pte_table_clamped_end() helper to calculate the end
From: Baolin Wang
Date: Fri Nov 13 2026 - 01:01:58 EST
On 11/13/26 1:01 PM, Barry Song wrote:
On Thu, Nov 12, 2026 at 7:13 PM Baolin Wang
<baolin.wang@xxxxxxxxxxxxxxxxx> wrote:
Use pte_table_clamped_end() to clamp the range to the PTE table and VMA
boundaries when batch-checking young flags, making the code more readable.
No functional changes intended.
Signed-off-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
---
Based on mm/core.git for-next branch.
Note that this was found while reviewing David's series:
https://lore.kernel.org/all/c31cc8a0-c098-4784-a843-f13f51914094@xxxxxxxxxxxxxxxxx/
---
mm/vmscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5495d9be90e8..804d4188e7b4 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4470,7 +4470,7 @@ bool lru_gen_look_around(struct page_vma_mapped_walk *pvmw, unsigned int nr)
walk = current->reclaim_state ? current->reclaim_state->mm_walk : NULL;
start = max(addr & PMD_MASK, vma->vm_start);
- end = min(addr | ~PMD_MASK, vma->vm_end - 1) + 1;
+ end = pte_table_clamped_end(addr, vma->vm_end);
We don't have pte_table_clamped_end() in Andrew's tree yet;
it's part of David's patch:
https://lore.kernel.org/all/20261111-pte_table_clamped_end-v1-1-2dbe339c487a@xxxxxxxxxx/
So we're not going through Andrew's tree for this patch, right?
Yes. I think David will pick up this follow-up.