From: SJ Park <sj@kernel.org>
Cc: SJ Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, linux-mm@kvack.org
Subject: [RFC PATCH v3 3/7] mm/damon/vaddr: implement sz_filter_passed for migrate_{hot,cold} action
Date: Fri, 27 Nov 2026 14:27:14 -0800 [thread overview]
Message-ID: <20261127222719.105510-4-sj@kernel.org> (raw)
In-Reply-To: <20261127222719.105510-1-sj@kernel.org>
Support of DAMOS ops filter and sz_filter_passed support is up to each
operation set. DAMON_VADDR supports both for only damos_stat action.
It intentionally does not support those for madvise-based actions
because applying filters could make it unnecessarily complicated and
expensive. The vaddr implementation of migrate_{hot,cold} action does
support DAMOS ops filters but sz_filter_passed. There is no real reason
to not support sz_filter_passed. Add the support.
Pass the sz_filter_passed pointer to the filter applying logic and
accumulate the number.
Closes: https://sashiko.dev/#/bug/linux-986e8b64-8e65-4e32-970f-4d3ebdf8206e
Signed-off-by: SJ Park <sj@kernel.org>
---
mm/damon/vaddr.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
index c8f93a19c840..721a23856ee1 100644
--- a/mm/damon/vaddr.c
+++ b/mm/damon/vaddr.c
@@ -776,6 +776,7 @@ static bool damos_va_filter_out(struct damos *scheme, struct folio *folio,
struct damos_va_migrate_private {
struct list_head *migration_lists;
struct damos *scheme;
+ unsigned long *sz_filter_passed;
};
/*
@@ -849,6 +850,7 @@ static int damos_va_migrate_pmd_entry(pmd_t *pmd, unsigned long addr,
struct damos_va_migrate_private *priv = walk->private;
struct list_head *migration_lists = priv->migration_lists;
struct damos *s = priv->scheme;
+ unsigned long *sz_filter_passed = priv->sz_filter_passed;
struct folio *folio;
spinlock_t *ptl;
pte_t *start_pte, *pte, ptent;
@@ -867,6 +869,7 @@ static int damos_va_migrate_pmd_entry(pmd_t *pmd, unsigned long addr,
s->last_applied = folio;
if (damos_va_filter_out(s, folio, walk->vma, addr, NULL, pmd))
goto huge_out;
+ *sz_filter_passed += folio_size(folio);
damos_va_migrate_dests_add(folio, walk->vma, addr, s,
migration_lists);
huge_out:
@@ -895,6 +898,7 @@ static int damos_va_migrate_pmd_entry(pmd_t *pmd, unsigned long addr,
s->last_applied = folio;
if (damos_va_filter_out(s, folio, walk->vma, addr, pte, NULL))
continue;
+ *sz_filter_passed += folio_size(folio);
damos_va_migrate_dests_add(folio, walk->vma, addr, s,
migration_lists);
}
@@ -973,6 +977,7 @@ static unsigned long damos_va_migrate(struct damon_target *target,
priv.migration_lists = kmalloc_objs(*priv.migration_lists, nr_dests);
if (!priv.migration_lists)
return 0;
+ priv.sz_filter_passed = sz_filter_passed;
for (int i = 0; i < nr_dests; i++)
INIT_LIST_HEAD(&priv.migration_lists[i]);
--
2.47.3
next prev parent reply other threads:[~2026-11-27 22:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 22:27 [RFC PATCH v3 0/7] mm/damon: various improvements/cleanups for code, tests and comments SJ Park
2026-11-27 22:27 ` [RFC PATCH v3 1/7] mm/damon/vaddr: advance migration attempt in folio level for filter out SJ Park
2026-11-27 22:27 ` [RFC PATCH v3 2/7] mm/damon/vaddr: use damos->last_applied for migrate action SJ Park
2026-11-27 22:33 ` sashiko-bot
2026-11-27 22:39 ` SJ Park
2026-11-27 22:27 ` SJ Park [this message]
2026-11-27 22:35 ` [RFC PATCH v3 3/7] mm/damon/vaddr: implement sz_filter_passed for migrate_{hot,cold} action sashiko-bot
2026-11-27 22:41 ` SJ Park
2026-11-27 22:27 ` [RFC PATCH v3 4/7] mm/damon/sysfs-schemes: drop redundant and racy zero target_value check SJ Park
2026-11-27 22:27 ` [RFC PATCH v3 5/7] selftests/damon/damos_apply_interval: remove unused variables SJ Park
2026-11-27 22:27 ` [RFC PATCH v3 6/7] selftests/damon: remove unused imports of sys and time modules SJ Park
2026-11-27 22:27 ` [RFC PATCH v3 7/7] mm/damon: update file intro comments to call DAMON just DAMON SJ Park
2026-11-27 22:35 ` [RFC PATCH v3 0/7] mm/damon: various improvements/cleanups for code, tests and comments sashiko-bot
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=20261127222719.105510-4-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--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