Thread (23 messages) 23 messages, 5 authors, 2026-02-26

Re: [PATCH 3/5] mm: add a batched helper to clear the young flag for large folios

From: Rik van Riel <riel@surriel.com>
Date: 2026-02-24 22:05:10
Also in: linux-mm, lkml

On Tue, 2026-02-24 at 09:56 +0800, Baolin Wang wrote:
+static inline int test_and_clear_young_ptes(struct vm_area_struct
*vma,
+					    unsigned long addr,
pte_t *ptep,
+					    unsigned int nr)
+{
+	int young = 0;
+
+	for (;;) {
+		young |= ptep_test_and_clear_young(vma, addr, ptep);
+		if (--nr == 0)
+			break;
+		ptep++;
+		addr += PAGE_SIZE;
+	}
This may be a nitpick, but could the --nr thing be
stuck into the loop conditional?

Something that looks like an infinite loop just
seems wrong for something so bounded.

-- 
All Rights Reversed.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help