All of lore.kernel.org
 help / color / mirror / Atom feed
* [merged mm-stable] mm-damon-paddr-deduplicate-damon_pa_mark_accesseddeactivate_pages.patch removed from -mm tree
@ 2022-10-03 21:07 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2022-10-03 21:07 UTC (permalink / raw)
  To: mm-commits, sj, akpm


The quilt patch titled
     Subject: mm/damon/paddr: deduplicate damon_pa_{mark_accessed,deactivate_pages}()
has been removed from the -mm tree.  Its filename was
     mm-damon-paddr-deduplicate-damon_pa_mark_accesseddeactivate_pages.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: SeongJae Park <sj@kernel.org>
Subject: mm/damon/paddr: deduplicate damon_pa_{mark_accessed,deactivate_pages}()
Date: Tue, 13 Sep 2022 17:44:29 +0000

The bodies of damon_pa_{mark_accessed,deactivate_pages}() contains
duplicates.  This commit factors out the common part to a separate
function and removes the duplicates.

Link: https://lkml.kernel.org/r/20220913174449.50645-3-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/damon/paddr.c |   26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

--- a/mm/damon/paddr.c~mm-damon-paddr-deduplicate-damon_pa_mark_accesseddeactivate_pages
+++ a/mm/damon/paddr.c
@@ -232,7 +232,8 @@ static unsigned long damon_pa_pageout(st
 	return applied * PAGE_SIZE;
 }
 
-static unsigned long damon_pa_mark_accessed(struct damon_region *r)
+static inline unsigned long damon_pa_mark_accessed_or_deactivate(
+		struct damon_region *r, bool mark_accessed)
 {
 	unsigned long addr, applied = 0;
 
@@ -241,27 +242,24 @@ static unsigned long damon_pa_mark_acces
 
 		if (!page)
 			continue;
-		mark_page_accessed(page);
+		if (mark_accessed)
+			mark_page_accessed(page);
+		else
+			deactivate_page(page);
 		put_page(page);
 		applied++;
 	}
 	return applied * PAGE_SIZE;
 }
 
-static unsigned long damon_pa_deactivate_pages(struct damon_region *r)
+static unsigned long damon_pa_mark_accessed(struct damon_region *r)
 {
-	unsigned long addr, applied = 0;
-
-	for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) {
-		struct page *page = damon_get_page(PHYS_PFN(addr));
+	return damon_pa_mark_accessed_or_deactivate(r, true);
+}
 
-		if (!page)
-			continue;
-		deactivate_page(page);
-		put_page(page);
-		applied++;
-	}
-	return applied * PAGE_SIZE;
+static unsigned long damon_pa_deactivate_pages(struct damon_region *r)
+{
+	return damon_pa_mark_accessed_or_deactivate(r, false);
 }
 
 static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
_

Patches currently in -mm which might be from sj@kernel.org are

mm-damon-core-initialize-damon_target-list-in-damon_new_target.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-03 21:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-03 21:07 [merged mm-stable] mm-damon-paddr-deduplicate-damon_pa_mark_accesseddeactivate_pages.patch removed from -mm tree Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.