diff mbox series

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

Message ID 20230910034048.59191-2-sj@kernel.org (mailing list archive)
State New
Headers show
Series mm/damon: implement DAMOS apply intervals | expand

Commit Message

SeongJae Park Sept. 10, 2023, 3:40 a.m. UTC
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@kernel.org>
---
 mm/damon/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

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;
 }