[RFC PATCH v2 2/9] mm/damon/paddr: support ops_filters

SeongJae Park
2025-02-27T01:58:03Z

DAMON keeps all DAMOS filters in damos->filters. No filter is saved in
damos->ops_filters, but upcoming changes will make it to use
damos->ops_filters to have all operations layer handled DAMOS filters.
DAMON physical address space operations set implementation (paddr) is
not ready for the changes, since it handles only damos->filters. To
avoid any breakage during the upcoming changes, make paddr to handle
both lists. After the change is made, ->filters support on paddr can be
safely removed.

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

diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index 25090230da17..3e651308ba5d 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -257,6 +257,10 @@ static bool damos_pa_filter_out(struct damos *scheme, struct folio *folio)
if (damos_pa_filter_match(filter, folio))
return !filter->allow;
}
+ damos_for_each_ops_filter(filter, scheme) {
+ if (damos_pa_filter_match(filter, folio))
+ return !filter->allow;
+ }
return false;
}

@@ -287,6 +291,12 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s,
break;
}
}
+ damos_for_each_ops_filter(filter, s) {
+ if (filter->type == DAMOS_FILTER_TYPE_YOUNG) {
+ install_young_filter = false;
+ break;
+ }
+ }
if (install_young_filter) {
filter = damos_new_filter(
DAMOS_FILTER_TYPE_YOUNG, true, false);
@@ -535,6 +545,8 @@ static bool damon_pa_scheme_has_filter(struct damos *s)

damos_for_each_filter(f, s)
return true;
+ damos_for_each_ops_filter(f, s)
+ return true;
return false;
}

--
2.39.5