Skip to contentSkip to conversation

mm-damon-paddr-increment-pa_stat-damon-address-range-by-folio-size.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jan 16, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon/paddr: increment pa_stat damon address range by folio size
has been removed from the -mm tree. Its filename was
mm-damon-paddr-increment-pa_stat-damon-address-range-by-folio-size.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Usama Arif <[email protected]>
Subject: mm/damon/paddr: increment pa_stat damon address range by folio size
Date: Mon, 13 Jan 2025 19:07:38 +0000

This is to avoid going through all the pages in a folio. For folio_size > PAGE_SIZE, damon_get_folio will return NULL for tail pages, so the for loop in those instances will be a nop. Have a more efficient loop by just incrementing the address by folio_size.

---

 mm/damon/paddr.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
mm/damon/paddr.c renamed from mm/damon/paddr.c~mm-damon-paddr-increment-pa_stat-damon-address-range-by-folio-size +6 -2
@@ -504,17 +504,21 @@ static unsigned long damon_pa_stat(struc
 	if (!damon_pa_scheme_has_filter(s))
 		return 0;
 
-	for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) {
+	addr = r->ar.start;
+	while (addr < r->ar.end) {
 		struct folio *folio = damon_get_folio(PHYS_PFN(addr));
 
-		if (!folio)
+		if (!folio) {
+			addr += PAGE_SIZE;
 			continue;
+		}
 
 		if (damos_pa_filter_out(s, folio))
 			goto put_folio;
 		else
 			*sz_filter_passed += folio_size(folio);
 put_folio:
+		addr += folio_size(folio);
 		folio_put(folio);
 	}
 	return 0;

_

Patches currently in -mm which might be from [email protected] are