Skip to content

Commit ebd3f70

Browse files
sjp38akpm00
authored andcommitted
mm/damon/paddr: do page level access check for pageout DAMOS action on its own
'pageout' DAMOS action implementation of 'paddr' DAMON operations set asks reclaim_pages() to do page level access check if the user is not asking DAMOS to do that on its own. Simplify the logic by making the check always be done by 'paddr'. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: SeongJae Park <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 69a5f99 commit ebd3f70

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

mm/damon/paddr.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,22 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s)
244244
{
245245
unsigned long addr, applied;
246246
LIST_HEAD(folio_list);
247-
bool ignore_references = false;
247+
bool install_young_filter = true;
248248
struct damos_filter *filter;
249249

250-
/* respect user's page level reference check handling request */
250+
/* check access in page level again by default */
251251
damos_for_each_filter(filter, s) {
252252
if (filter->type == DAMOS_FILTER_TYPE_YOUNG) {
253-
ignore_references = true;
253+
install_young_filter = false;
254254
break;
255255
}
256256
}
257+
if (install_young_filter) {
258+
filter = damos_new_filter(DAMOS_FILTER_TYPE_YOUNG, true);
259+
if (!filter)
260+
return 0;
261+
damos_add_filter(s, filter);
262+
}
257263

258264
for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) {
259265
struct folio *folio = damon_get_folio(PHYS_PFN(addr));
@@ -275,7 +281,9 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s)
275281
put_folio:
276282
folio_put(folio);
277283
}
278-
applied = reclaim_pages(&folio_list, ignore_references);
284+
if (install_young_filter)
285+
damos_destroy_filter(filter);
286+
applied = reclaim_pages(&folio_list, true);
279287
cond_resched();
280288
return applied * PAGE_SIZE;
281289
}

0 commit comments

Comments
 (0)