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

mm/damon/core: increase regions merge aggressiveness while respecting min_nr_regions

DAMON's merge mechanism has two thresholds, namely those for access
frequency and size.  The access frequency threshold avoids merging two
adjacent regions that having pretty different access frequency.

The size threshold is calculated as total size of regions divided by
min_nr_regions.  Merging operation skip merging two adjacent regions if
the resulting region's size can be larger than the threshold.  This is for
meeting min_nr_regions.

Commit 44fdaf596984 ("mm/damon/core: merge regions aggressively when
max_nr_regions is unmet") of mm-unstable, however, ignores the
min_nr_regions by increasing not only access frequency threshold but also
the size threshold.

The commit also has one more problem.  User could set DAMON target regions
with more than max_nr_regions discrete regions.  Because DAMON cannot
merge non-adjacent regions, the number of regions will never be lower than
max_nr_regions regardless of the increased thresholds.  As a result, the
function can infinitely repeat the loop.

Increase only access frequency threshold, up to only possible maximum
value.

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


Fixes: 44fdaf596984 ("mm/damon/core: merge regions aggressively when max_nr_regions is unmet") # mm-unstable
Signed-off-by: default avatarSeongJae Park <sj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent c906f3c2
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