[RFC 1/8] mm/damon/core: make DAMOS uses nr_accesses_bp instead of nr_accesses

From: SeongJae Park
Date: Sat Sep 09 2023 - 23:41:12 EST


DAMON provides nr_accesses_bp, which becomes same to nr_accesses * 10000
for every aggregation interval, but updated every sampling interval with
a reasonable accuracy. Since DAMON-based operation schemes are applied
in every aggregation interval using nr_accesses, using nr_accesses_bp
instead will make no difference. This also makes future DAMOS changes
for applying the scheme in a time interval that less than the
aggregation interval possible.

Signed-off-by: SeongJae Park <sj@xxxxxxxxxx>
---
mm/damon/core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/damon/core.c b/mm/damon/core.c
index 83b0cd329e84..3e0532c6896c 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -799,12 +799,13 @@ static void damon_split_region_at(struct damon_target *t,
static bool __damos_valid_target(struct damon_region *r, struct damos *s)
{
unsigned long sz;
+ unsigned int nr_accesses = r->nr_accesses_bp / 10000;

sz = damon_sz_region(r);
return s->pattern.min_sz_region <= sz &&
sz <= s->pattern.max_sz_region &&
- s->pattern.min_nr_accesses <= r->nr_accesses &&
- r->nr_accesses <= s->pattern.max_nr_accesses &&
+ s->pattern.min_nr_accesses <= nr_accesses &&
+ nr_accesses <= s->pattern.max_nr_accesses &&
s->pattern.min_age_region <= r->age &&
r->age <= s->pattern.max_age_region;
}
--
2.25.1