Skip to content
Commit f2d32ef6 authored by SeongJae Park's avatar SeongJae Park Committed by Andrew Morton
Browse files

mm/damon/core: ensure max threshold attempt for max_nr_regions violation

Since commit ed6cb9d022c8 ("mm/damon/core: increase regions merge
aggressiveness while respecting min_nr_regions") of mm-unstable,
kdamond_merge_regions() stops the repeated merge attempts for meeting
max_nr_regions if the merge threshold that increased for next iteration is
higher than the possible maximum threshold.  Hence, it can skip a merge
attempt with the maximum threshold depending on the amount of the
threshold increase, the maximum threshold, and the last-used threshold
value.  In extreme situations (e.g., region 1 has 100% access frequency,
region 2 has 0% access frequency, so on), this can degrade the
max_nr_regions violation recovery.

Fix this by stopping the loop by comparing the last-used threshold instead
of the to-be-used threshold, and if the last-used threshold is same to or
higher than the maximum possible threshold.

Link: https://lkml.kernel.org/r/20240627163153.75969-1-sj@kernel.org


Fixes: ed6cb9d022c8 ("mm/damon/core: increase regions merge aggressiveness while respecting min_nr_regions") # mm-unstable
Signed-off-by: default avatarSeongJae Park <sj@kernel.org>
Closes: https://lore.kernel.org/20240626214954.46143-1-sj@kernel.org


Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 3ff9c307
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment