aboutsummaryrefslogtreecommitdiffstats
path: root/patches/next/mm-damon-paddr-check-access-in-page-level-again-for-.patch
blob: 6f53ab7e2ef10f9540df3ac5031be995567ac03d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From 05447eb51fe8fee054164043d6aac915ac4d8700 Mon Sep 17 00:00:00 2001
From: SeongJae Park <sj@kernel.org>
Date: Fri, 8 Mar 2024 16:06:00 -0800
Subject: [PATCH] mm/damon/paddr: check access in page level again for pageout
 DAMOS

DAMON does access monitoring in the region granularity in best level.
Hence, a region could be reported as cold, while a few pages in the
region is hot.  To fill the gap, DAMOS pageout action implementation of
DAMON operations set for the physical address space (paddr) checks the
access to each page again by setting 'ignore_references' argument of
'reclaim_pages()' as false.  Since DAMOS filters of young type is
introduced, doing the recheck always could ignore users' intention.  Do
the recheck only if users didn't make specific such request by adding
the young type DAMOS filter.

Signed-off-by: SeongJae Park <sj@kernel.org>
---
 mm/damon/paddr.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index 5685ba485097d..d5f2f7ddf8638 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -244,6 +244,16 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s)
 {
 	unsigned long addr, applied;
 	LIST_HEAD(folio_list);
+	bool ignore_references = false;
+	struct damos_filter *filter;
+
+	/* respect user's page level reference check handling request */
+	damos_for_each_filter(filter, s) {
+		if (filter->type == DAMOS_FILTER_TYPE_YOUNG) {
+			ignore_references = true;
+			break;
+		}
+	}
 
 	for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) {
 		struct folio *folio = damon_get_folio(PHYS_PFN(addr));
@@ -265,7 +275,7 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s)
 put_folio:
 		folio_put(folio);
 	}
-	applied = reclaim_pages(&folio_list, false);
+	applied = reclaim_pages(&folio_list, ignore_references);
 	cond_resched();
 	return applied * PAGE_SIZE;
 }
-- 
2.39.2