Re: [RFC PATCH 3/3] mm/damon/paddr: support DAMOS filter type YOUNG

From: SeongJae Park
Date: Fri Mar 08 2024 - 20:53:22 EST


On Wed, 6 Mar 2024 19:00:13 -0800 SeongJae Park <sj@xxxxxxxxxx> wrote:

> DAMOS filter of type YOUNG is defined, but not yet implemented by any
> DAMON operations set. Add the implementation to the DAMON operations
> set for the physical address space, paddr.
>
> Signed-off-by: SeongJae Park <sj@xxxxxxxxxx>
> ---
> mm/damon/paddr.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
> index deee0fdf2e5b..52e4be7351cc 100644
> --- a/mm/damon/paddr.c
> +++ b/mm/damon/paddr.c
> @@ -209,6 +209,9 @@ static bool __damos_pa_filter_out(struct damos_filter *filter,
> matched = filter->memcg_id == mem_cgroup_id(memcg);
> rcu_read_unlock();
> break;
> + case DAMOS_FILTER_TYPE_YOUNG:
> + matched = damon_folio_young(folio);
> + break;

damon_folio_young() doesn't reset the Accessed bit of the folio. Hence, unless
something is resetting the bit, this damon_folio_young() call will repeatedly
return true even if there was no access to the folio since last check. We
should implement Accessed bit test-and-reset variant of this function and
replace this, or call damon_pa_mkold() when 'matched' is 'true'.

I will fix this in the next spin.


Thanks,
SJ


> default:
> break;
> }
> --
> 2.39.2