diff mbox series

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

Message ID 20240307030013.47041-4-sj@kernel.org (mailing list archive)
State New
Headers show
Series mm/damon: add a DAMOS filter type for page granularity access recheck | expand

Commit Message

SeongJae Park March 7, 2024, 3 a.m. UTC
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@kernel.org>
---
 mm/damon/paddr.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

SeongJae Park March 9, 2024, 1:53 a.m. UTC | #1
On Wed,  6 Mar 2024 19:00:13 -0800 SeongJae Park <sj@kernel.org> 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@kernel.org>
> ---
>  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
diff mbox series

Patch

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;
 	default:
 		break;
 	}