Docs/mm/damon/design: clarify regions merging operation

DAMON design document is not explaining how min_nr_regions limit is kept,
and what happens if the number of regions exceeds max_nr_regions.  Add
more clarification for those.

Link: https://lkml.kernel.org/r/20240701192706.51415-3-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
SeongJae Park 2024-07-01 12:26:59 -07:00 committed by Andrew Morton
parent efeacc2cb6
commit 2081610d98

View File

@ -209,11 +209,18 @@ the data access pattern can be dynamically changed. This will result in low
monitoring quality. To keep the assumption as much as possible, DAMON monitoring quality. To keep the assumption as much as possible, DAMON
adaptively merges and splits each region based on their access frequency. adaptively merges and splits each region based on their access frequency.
For each ``aggregation interval``, it compares the access frequencies of For each ``aggregation interval``, it compares the access frequencies
adjacent regions and merges those if the frequency difference is small. Then, (``nr_accesses``) of adjacent regions. If the difference is small, and if the
after it reports and clears the aggregated access frequency of each region, it sum of the two regions' sizes is smaller than the size of total regions divided
splits each region into two or three regions if the total number of regions by the ``minimum number of regions``, DAMON merges the two regions. If the
will not exceed the user-specified maximum number of regions after the split. resulting number of total regions is still higher than ``maximum number of
regions``, it repeats the merging with increasing access frequenceis difference
threshold until the upper-limit of the number of regions is met, or the
threshold becomes higher than possible maximum value (``aggregation interval``
divided by ``sampling interval``). Then, after it reports and clears the
aggregated access frequency of each region, it splits each region into two or
three regions if the total number of regions will not exceed the user-specified
maximum number of regions after the split.
In this way, DAMON provides its best-effort quality and minimal overhead while In this way, DAMON provides its best-effort quality and minimal overhead while
keeping the bounds users set for their trade-off. keeping the bounds users set for their trade-off.