Skip to content

mm/damon: support multiple goal-based quota tuning algorithms

SeongJae Park damon linux-doc linux-kselftest linux-mm lkml 1 version Applied

Status from this message: [merged mm-stable] selftests-damon-sysfspy-test-goal_tuner-commit.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 0 repliesApplied 11/11

Changes from RFC v2 from the cover letter

(https://lore.kernel.org/[email protected])
- Rename damos_quota_set() to damos_quota_is_set().
- Drop unnecessary ->goal_tuner set on damos_new_quota().
- Add kunit test.
- Add goal_tuenr kernel-doc comment.

Patches in v1 All 11 applied

#Subject and filesSizeRepliesApplied
1/11mm/damon/core: introduce damos_quota_goal_tunerinclude/linux/damon.h mm/damon/core.c+11 -00 repliesApplied
2/11mm/damon/core: allow quota goals set zero effective size quotamm/damon/core.c+26 -50 repliesApplied
3/11mm/damon/core: introduce DAMOS_QUOTA_GOAL_TUNER_TEMPORALinclude/linux/damon.h mm/damon/core.c+26 -50 repliesApplied
4/11mm/damon/sysfs-schemes: implement quotas->goal_tuner filemm/damon/sysfs-schemes.c+58 -00 repliesApplied
5/11Docs/mm/damon/design: document the goal-based quota tuner selectionsDocumentation/mm/damon/design.rst+12 -00 repliesApplied
6/11Docs/admin-guide/mm/damon/usage: document goal_tuner sysfs fileDocumentation/admin-guide/mm/damon/usage.rst+12 -40 repliesApplied
7/11Docs/ABI/damon: update for goal_tunerDocumentation/ABI/testing/sysfs-kernel-mm-damon+6 -00 repliesApplied
8/11mm/damon/tests/core-kunit: test goal_tuner commitmm/damon/tests/core-kunit.h+3 -00 repliesApplied
9/11selftests/damon/_damon_sysfs: support goal_tuner setuptools/testing/selftests/damon/_damon_sysfs.py+9 -30 repliesApplied
10/11selftests/damon/drgn_dump_damon_status: support quota goal_tuner dumpingtools/testing/selftests/damon/drgn_dump_damon_status.py+1 -00 repliesApplied
11/11selftests/damon/sysfs.py: test goal_tuner committools/testing/selftests/damon/sysfs.py+7 -00 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/11] mm/damon: support multiple goal-based quota tuning algorithms

Aim-oriented DAMOS quota auto-tuning uses a single tuning algorithm. The algorithm is designed to find a quota value that should be consistently kept for achieving the aimed goal for long term. It is useful and reliable at automatically operating systems that have dynamic environments in the long term.

As always, however, no single algorithm fits all. When the environment has static characteristics or there are control towers in not only the kernel space but also the user space, the algorithm shows some limitations. In such environments, users want kernel work in a more short term deterministic way. Actually there were at least two reports [1,2] of such cases.

Extend DAMOS quotas goal to support multiple quota tuning algorithms that users can select. Keep the current algorithm as the default one, to not break the old users. Also give it a name, "consist", as it is designed to "consistently" apply the DAMOS action. And introduce a new tuning algorithm, namely "temporal". It is designed to apply the DAMOS action only temporally, in a deterministic way. In more detail, as long as the goal is under-achieved, it uses the maximum quota available. Once the goal is over-achieved, it sets the quota zero.

Tests
=====

I confirmed the feature is working as expected using the latest version of DAMON user-space tool, like below.

    $ # start DAMOS for reclaiming memory aiming 30% free memory
    $ sudo ./damo/damo start --damos_action pageout \
            --damos_quota_goal_tuner temporal \
            --damos_quota_goal node_mem_free_bp 30% 0 \
            --damos_quota_interval 1s \
            --damos_quota_space 100M

Note that >=3.1.8 version of DAMON user-space tool supports this feature (--damos_quota_goal_tuner). As expected, DAMOS stops reclaiming memory as soon as the goal amount of free memory is made. When 'consist' tuner is used, the reclamation was continued even after the goal amount of free memory is made, resulting in more than goal amount of free memory, as expected.

Patch Sequence
==============

First four patches implement the features. Patch 1 extends core API to allow multiple tuners and make the current tuner as the default and only available tuner, namely 'consist'. Patch 2 allows future tuners setting zero effective quota. Patch 3 introduces the second tuner, namely 'temporal'. Patch 4 further extends DAMON sysfs API to let users use that.

Three following patches (patches 5-7) update design, usage, and ABI documents, respectively.

Final four patches (patches 8-11) are for adding tests. The eighth patch (patch 8) extends the kunit test for online parameters commit for validating the goal_tuner. The ninth and the tenth patches (patches 9-10) extend the testing-purpose DAMON sysfs control helper and DAMON status dumping tool to support the newly added feature. The final eleventh one (patch 11) extends the existing online commit selftest to cover the new feature.

References
==========

[1] https://lore.kernel.org/CALa+Y17__d=ZsM1yX+MXx0ozVdsXnFqF4p0g+kATEitrWyZFfg@mail.gmail.com
[2] https://lore.kernel.org/[email protected]

Changelog
=========

Changes from RFC v2
(https://lore.kernel.org/[email protected])
- Rename damos_quota_set() to damos_quota_is_set().
- Drop unnecessary ->goal_tuner set on damos_new_quota().
- Add kunit test.
- Add goal_tuenr kernel-doc comment.

Changes from RFC v1
(https://lore.kernel.org/[email protected])
- Add selftest for goal_tuner commitment.
- Set goal tuner inside damon_new_scheme().
- Allow zero size effective size quota.
- Update the ABI document.
- Wordsmith change descriptions.

SeongJae Park (11):
mm/damon/core: introduce damos_quota_goal_tuner mm/damon/core: allow quota goals set zero effective size quota mm/damon/core: introduce DAMOS_QUOTA_GOAL_TUNER_TEMPORAL mm/damon/sysfs-schemes: implement quotas->goal_tuner file Docs/mm/damon/design: document the goal-based quota tuner selections Docs/admin-guide/mm/damon/usage: document goal_tuner sysfs file Docs/ABI/damon: update for goal_tuner mm/damon/tests/core-kunit: test goal_tuner commit selftests/damon/_damon_sysfs: support goal_tuner setup selftests/damon/drgn_dump_damon_status: support quota goal_tuner
dumping
selftests/damon/sysfs.py: test goal_tuner commit

 .../ABI/testing/sysfs-kernel-mm-damon         |  6 ++
 Documentation/admin-guide/mm/damon/usage.rst  | 16 +++--
 Documentation/mm/damon/design.rst             | 12 ++++
 include/linux/damon.h                         | 12 ++++
 mm/damon/core.c                               | 61 ++++++++++++++++---
 mm/damon/sysfs-schemes.c                      | 58 ++++++++++++++++++
 mm/damon/tests/core-kunit.h                   |  3 +
 tools/testing/selftests/damon/_damon_sysfs.py | 12 +++-
 .../selftests/damon/drgn_dump_damon_status.py |  1 +
 tools/testing/selftests/damon/sysfs.py        |  7 +++
 10 files changed, 171 insertions(+), 17 deletions(-)

base-commit: 65dad07b05cbdda486d599772f908f1df45dd306

Signature · 1 line
2.47.3