[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220513150000.25797-4-sj@kernel.org>
Date: Fri, 13 May 2022 17:00:00 +0200
From: SeongJae Park <sj@...nel.org>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-damon@...zon.com, damon@...ts.linux.dev, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, SeongJae Park <sj@...nel.org>
Subject: [RFC PATCH 3/3] mm/damon/paddr: Support DAMOS_COLD
DAMOS_COLD is currently supported by the virtual address spaces
monitoring operations set (vaddr). This commit adds support of the
action to the physical address space monitoring operations set (paddr).
Using this together with hot DAMOS action, users can proactively sort
LRU lists so that performance degradation under memory pressure can be
reduced.
Signed-off-by: SeongJae Park <sj@...nel.org>
---
mm/damon/paddr.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index 69980b922bf4..761b1580271c 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -249,6 +249,22 @@ static unsigned long damon_pa_mark_accessed(struct damon_region *r)
return applied * PAGE_SIZE;
}
+static unsigned long damon_pa_cold(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));
+
+ if (!page)
+ continue;
+ deactivate_page(page);
+ put_page(page);
+ applied++;
+ }
+ return applied * PAGE_SIZE;
+}
+
static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
struct damon_target *t, struct damon_region *r,
struct damos *scheme)
@@ -258,6 +274,8 @@ static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
return damon_pa_pageout(r);
case DAMOS_HOT:
return damon_pa_mark_accessed(r);
+ case DAMOS_COLD:
+ return damon_pa_cold(r);
default:
break;
}
@@ -273,6 +291,8 @@ static int damon_pa_scheme_score(struct damon_ctx *context,
return damon_pageout_score(context, r, scheme);
case DAMOS_HOT:
return damon_hot_score(context, r, scheme);
+ case DAMOS_COLD:
+ return damon_pageout_score(context, r, scheme);
default:
break;
}
--
2.17.1
Powered by blists - more mailing lists