Skip to content

Commit 69a5f99

Browse files
sjp38akpm00
authored andcommitted
mm/damon/paddr: avoid unnecessary page level access check for pageout DAMOS action
Patch series "mm/damon/paddr: simplify page level access re-check for pageout. The 'pageout' DAMOS action implementation of 'paddr' asks reclaim_pages() to do page level access check again. But the user can ask 'paddr' to do the page level access check on its own, using DAMOS filter of 'young page' type. Meanwhile, 'paddr' is the only user of reclaim_pages() that asks the page level access check. Make 'paddr' does the page level access check on its own always, and simplify reclaim_pages() by removing the page level access check request handling logic. As a result of the change for reclaim_pages(), reclaim_folio_list(), which is called by reclaim_pages(), also no more need to do the page level access check. Simplify the function, too. This patch (of 4): 'pageout' DAMOS action implementation of 'paddr' asks reclaim_pages() to do the page level access check. User could ask DAMOS to do the page level access check on its own using 'young page' type DAMOS filter. In the case, pageout DAMOS action unnecessarily asks reclaim_pages() to do the check again. Ask the page level access check only if the scheme is not having the filter. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: SeongJae Park <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 01d89b9 commit 69a5f99

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

mm/damon/paddr.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,16 @@ 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;
248+
struct damos_filter *filter;
249+
250+
/* respect user's page level reference check handling request */
251+
damos_for_each_filter(filter, s) {
252+
if (filter->type == DAMOS_FILTER_TYPE_YOUNG) {
253+
ignore_references = true;
254+
break;
255+
}
256+
}
247257

248258
for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) {
249259
struct folio *folio = damon_get_folio(PHYS_PFN(addr));
@@ -265,7 +275,7 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s)
265275
put_folio:
266276
folio_put(folio);
267277
}
268-
applied = reclaim_pages(&folio_list, false);
278+
applied = reclaim_pages(&folio_list, ignore_references);
269279
cond_resched();
270280
return applied * PAGE_SIZE;
271281
}

0 commit comments

Comments
 (0)