From: SeongJae Park <sj@kernel.org>
Cc: SeongJae Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, kernel-team@meta.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [RFC PATCH 04/11] mm/damon/paddr: activate DAMOS_LRU_PRIO targets instead of marking accessed
Date: Sat, 28 Jun 2025 09:51:37 -0700 [thread overview]
Message-ID: <20250628165144.55528-5-sj@kernel.org> (raw)
In-Reply-To: <20250628165144.55528-1-sj@kernel.org>
DAMOS_LRU_DEPRIOD directly deactivate the pages, while DAMOS_LRU_PRIO
calls folio_mark_accessed(), which does incremental activation. The
incremental activation was assumed to be useful for making sure the
pages of the hot memory region are really hot. After the introduction
of DAMOS_LRU_PRIO, the young page filter has added. Users can use the
young page filter to make sure the page is eligible to be activated.
Meanwhile, the asymmetric behavior of DAMOS_LRU_[DE]PRIO can confuse
users.
Directly activate given pages for DAMOS_LRU_PRIO, to eliminate the
unnecessary incremental activation steps, and be symmetric with
DAMOS_LRU_DEPRIO for easier usages.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/paddr.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index d4261da48b0a..34d4b3017043 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -474,8 +474,8 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s,
return applied * PAGE_SIZE;
}
-static inline unsigned long damon_pa_mark_accessed_or_deactivate(
- struct damon_region *r, struct damos *s, bool mark_accessed,
+static inline unsigned long damon_pa_de_activate(
+ struct damon_region *r, struct damos *s, bool activate,
unsigned long *sz_filter_passed)
{
unsigned long addr, applied = 0;
@@ -494,8 +494,8 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate(
else
*sz_filter_passed += folio_size(folio);
- if (mark_accessed)
- folio_mark_accessed(folio);
+ if (activate)
+ folio_activate(folio);
else
folio_deactivate(folio);
applied += folio_nr_pages(folio);
@@ -507,18 +507,16 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate(
return applied * PAGE_SIZE;
}
-static unsigned long damon_pa_mark_accessed(struct damon_region *r,
+static unsigned long damon_pa_activate_pages(struct damon_region *r,
struct damos *s, unsigned long *sz_filter_passed)
{
- return damon_pa_mark_accessed_or_deactivate(r, s, true,
- sz_filter_passed);
+ return damon_pa_de_activate(r, s, true, sz_filter_passed);
}
static unsigned long damon_pa_deactivate_pages(struct damon_region *r,
struct damos *s, unsigned long *sz_filter_passed)
{
- return damon_pa_mark_accessed_or_deactivate(r, s, false,
- sz_filter_passed);
+ return damon_pa_de_activate(r, s, false, sz_filter_passed);
}
static unsigned int __damon_pa_migrate_folio_list(
@@ -803,7 +801,7 @@ static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
case DAMOS_PAGEOUT:
return damon_pa_pageout(r, scheme, sz_filter_passed);
case DAMOS_LRU_PRIO:
- return damon_pa_mark_accessed(r, scheme, sz_filter_passed);
+ return damon_pa_activate_pages(r, scheme, sz_filter_passed);
case DAMOS_LRU_DEPRIO:
return damon_pa_deactivate_pages(r, scheme, sz_filter_passed);
case DAMOS_MIGRATE_HOT:
--
2.39.5
next prev parent reply other threads:[~2025-06-28 16:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-28 16:51 [RFC PATCH 00/11] mm/damon: advance DAMOS-based LRU sorting SeongJae Park
2025-06-28 16:51 ` [RFC PATCH 01/11] mm/damon/core: introduce [in]active memory ratio damos quota goal metric SeongJae Park
2025-06-28 16:51 ` [RFC PATCH 02/11] mm/damon/sysfs-schemes: support DAMOS_QUOTA_[IN]ACTIVE_MEM_BP SeongJae Park
2025-06-28 16:51 ` [RFC PATCH 03/11] Docs/mm/damon/design: document DAMOS_QUOTA_[IN]ACTIVE_MEM_BP SeongJae Park
2025-06-28 16:51 ` SeongJae Park [this message]
2025-06-28 16:51 ` [RFC PATCH 05/11] mm/damon/lru_sort: consider age for quota prioritization SeongJae Park
2025-06-28 16:51 ` [RFC PATCH 06/11] mm/damon/lru_sort: support young page filters SeongJae Park
2025-06-28 16:51 ` [RFC PATCH 07/11] Docs/admin-guide/mm/damon/lru_sort: document filter_young_pages SeongJae Park
2025-06-28 16:51 ` [RFC PATCH 08/11] mm/damon/lru_sort: support active:inactive memory ratio based auto-tuning SeongJae Park
2025-06-28 16:51 ` [RFC PATCH 09/11] Docs/admin-guide/mm/damon/lru_sort: document active_mem_bp parameter SeongJae Park
2025-06-28 16:51 ` [RFC PATCH 10/11] mm/damon/lru_sort: add monitoring intervals auto-tuning parameter SeongJae Park
2025-06-28 16:51 ` [RFC PATCH 11/11] Docs/admin-guide/mm/damon/lru_sort: document intervals autotuning SeongJae Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250628165144.55528-5-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).