The patch titled Subject: Docs/mm/damon/design: clarify regions merging operation has been added to the -mm mm-unstable branch. Its filename is docs-mm-damon-design-clarify-regions-merging-operation.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/docs-mm-damon-design-clarify-regions-merging-operation.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: SeongJae Park <sj@xxxxxxxxxx> Subject: Docs/mm/damon/design: clarify regions merging operation Date: Mon, 1 Jul 2024 12:26:59 -0700 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@xxxxxxxxxx Signed-off-by: SeongJae Park <sj@xxxxxxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/mm/damon/design.rst | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) --- a/Documentation/mm/damon/design.rst~docs-mm-damon-design-clarify-regions-merging-operation +++ a/Documentation/mm/damon/design.rst @@ -209,11 +209,18 @@ the data access pattern can be dynamical monitoring quality. To keep the assumption as much as possible, DAMON adaptively merges and splits each region based on their access frequency. -For each ``aggregation interval``, it compares the access frequencies of -adjacent regions and merges those if the frequency difference is small. 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. +For each ``aggregation interval``, it compares the access frequencies +(``nr_accesses``) of adjacent regions. If the difference is small, and if the +sum of the two regions' sizes is smaller than the size of total regions divided +by the ``minimum number of regions``, DAMON merges the two regions. If the +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 keeping the bounds users set for their trade-off. _ Patches currently in -mm which might be from sj@xxxxxxxxxx are mm-damon-core-merge-regions-aggressively-when-max_nr_regions-is-unmet.patch mm-damon-core-merge-regions-aggressively-when-max_nr_regions-is-unmet-fix.patch mm-damon-core-merge-regions-aggressively-when-max_nr_regions-is-unmet-fix-2.patch docs-mm-damon-design-fix-two-typos.patch docs-mm-damon-design-clarify-regions-merging-operation.patch docs-admin-guide-mm-damon-start-add-access-pattern-snapshot-example.patch docs-mm-damon-design-add-links-from-overall-architecture-to-sections-of-details.patch docs-mm-damon-design-move-configurable-operations-set-section-into-operations-set-layer-section.patch docs-mm-damon-design-remove-programmable-modules-section-in-favor-of-modules-section.patch docs-mm-damon-design-add-links-to-sections-of-damon-sysfs-interface-usage-doc.patch docs-mm-damon-index-add-links-to-design.patch docs-mm-damon-index-add-links-to-admin-guide-doc.patch