mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit
Subsystems (3)
SJ Park
maintainercover mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit
Improve efficiency of DAMOS_PAGEOUT in paddr and apply_probes() in core by skipping unnecessary operations, via patches 1 and 2 from Aveline Noir. Fix a selftest for a false positive failure, via patch 3 from Aveline Noir. Add a kunit test for damon_call(), via patch 4 from Sailesh Nandanavanam.
This is a batched reposting of separately posted and reviewed patches for being merged into the mm.git. Refer to changelog on each patch for changes that were made before this reposting.
Aveline Noir (3):
mm/damon/paddr: skip non-LRU folios as a whole in pageout mm/damon/core: skip apply_probes() when no probes are installed selftests/damon/damos_quota: skip the last sample when counting
exceeds
Sailesh Nandanavanam (1):
mm/damon/tests/core-kunit: add test for damon_call()
mm/damon/core.c | 2 +- mm/damon/paddr.c | 4 +++- mm/damon/tests/core-kunit.h | 22 ++++++++++++++++++++ tools/testing/selftests/damon/damos_quota.py | 7 ++++--- 4 files changed, 30 insertions(+), 5 deletions(-)
base-commit: c2b9a116bd15d6afa6c3d032e97136fc67f06970
Signature · 1 line
2.47.3
SJ Park
maintainerPATCH 1/4 mm/damon/paddr: skip non-LRU folios as a whole in pageout
From: Aveline Noir <[email protected]>
damon_pa_pageout() uses damon_get_folio(), which rejects folios that are not on the LRU. For a large non-LRU folio such as a hugetlb folio, the loop then looks up the same folio once per base page even though pageout cannot reclaim it.
Use damon_get_monitor_folio() and skip any returned non-LRU folio as a whole by advancing to its end. Do this before the filters, the accounting and the last_applied check, so that adjacent regions within the same non-LRU folio are not walked by base page either.
In an x86-64 KVM pageout microbenchmark, traversal time dropped by about 99.7% for regions covering whole 2 MiB hugetlb folios. For 4 KiB regions within hugetlb folios, traversal took about 1 ns more per region.
---
Changes from v2
- v2: https://lore.kernel.org/20261118-fix-damon-hugetlb-pageout-20261117-v2-1-547a65a3206e@gmail.com
- Collect R-b: from Enze and SJ.
- Rebase to the latest mm-new.
Changes in v2:
- v1: https://lore.kernel.org/20261117-fix-damon-hugetlb-pageout-20261117-v1-1-054ef8760a92@gmail.com
- Drop the redundant hugetlb check and update the subject and
description as suggested by SJ.
mm/damon/paddr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/damon/paddr.c +3 -1
@@ -268,7 +268,9 @@ static unsigned long damon_pa_pageout(struct damon_region *r, addr =damon_pa_phys_addr (r->ar.start, addr_unit);while (addr <damon_pa_phys_addr (r->ar.end, addr_unit)) { - folio =damon_get_folio (PHYS_PFN (addr)); + folio =damon_get_monitor_folio (PHYS_PFN (addr)); +if (folio && !folio_test_lru (folio)) + goto put_folio;if (damon_pa_invalid_damos_folio (folio, s)) { addr +=PAGE_SIZE ;continue ;
Signature · 1 line
2.47.3
SJ Park
maintainerPATCH 2/4 mm/damon/core: skip apply_probes() when no probes are installed
In reply to SJ ParkFrom: Aveline Noir <[email protected]>
While measuring vaddr monitoring overhead, I noticed that kdamond calls apply_probes() every sampling interval even if no probes are installed. The vaddr callback walks the page tables for each region's sample, and paddr looks up a folio and takes a reference if it can. There are no probe hits to count in either case.
Skip the callback when the probe list is empty. Ordinary access checks still run, and installed probes with zero weight are still applied.
---
Changes from v1
- v1: https://lore.kernel.org/20261119-damon-skip-empty-probes-20261119-v1-1-ec3e81c1f26b@gmail.com
- Collect R-b: from SJ.
- Rebase to the latest mm-new.
mm/damon/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/core.c +1 -1
@@ -4105,7 +4105,7 @@ static int kdamond_fn(void *data)if (!access_check_disabled && ctx->ops.check_accesses) max_merge_score = ctx->ops.check_accesses (ctx); -if (ctx->ops.apply_probes) { +if (ctx->ops.apply_probes && !list_empty (&ctx->probes)) {if (time_after_eq (ctx->passed_sample_intervals, next_aggregation_sis) && access_check_disabled)
Signature · 1 line
2.47.3
SJ Park
maintainerPATCH 3/4 selftests/damon/damos_quota: skip the last sample when counting exceeds
In reply to SJ ParkFrom: Aveline Noir <[email protected]>
damos_quota.py expects qt_exceeds to be increased for every sample whose tried_bytes equals the quota. The kernel increases it only when the next quota window starts, so the last full window may still be pending when the workload exits. The test then fails with an expected count one higher than the actual one, e.g., 15 < 16.
Do not count the last sample. Also drop the sorting of the samples, so that the last one is the latest.
---
Changes from v1
- v1: https://lore.kernel.org/20261117-fix-damon-quota-selftest-20261117-v1-1-c65d687d3def@gmail.com
- Collect R-b: from SJ.
- Rebase to the latest mm-new.
tools/testing/selftests/damon/damos_quota.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
tools/testing/selftests/damon/damos_quota.py +4 -3
@@ -53,15 +53,16 @@ def main(): wss_collected.append(scheme.tried_bytes) nr_quota_exceeds = scheme.stats.qt_exceeds - wss_collected.sort() nr_expected_quota_exceeds = 0 - for wss in wss_collected: + for idx, wss in enumerate(wss_collected): if wss > sz_quota: print('quota is not kept: %s > %s' % (wss, sz_quota)) print('collected samples are as below') print('\n'.join(['%d' % wss for wss in wss_collected])) exit(1) - if wss == sz_quota: + # qt_exceeds is updated when the next quota window starts, so skip + # the last sample, whose window may still be pending. + if wss == sz_quota and idx < len(wss_collected) - 1: nr_expected_quota_exceeds += 1 if nr_quota_exceeds < nr_expected_quota_exceeds:
Signature · 1 line
2.47.3
SJ Park
maintainerPATCH 4/4 mm/damon/tests/core-kunit: add test for damon_call()
In reply to SJ ParkFrom: Sailesh Nandanavanam <[email protected]>
A newly allocated damon_ctx has call_controls_obsolete set, meaning no kdamond is available to handle call requests. damon_call() should return -ECANCELED in that case instead of queueing the request and waiting forever. When call_controls_obsolete is unset and damon_call_control->repeat is set, damon_call() should return 0 without waiting for kdamond. Add a kunit test for the two cases.
---
Changes from v2
- v2: https://lore.kernel.org/[email protected]
- Collect R-b: from SJ.
- Rebase to the latest mm-new.
Changes from v1
(https://lore.kernel.org/[email protected],
https://lore.kernel.org/[email protected])
- Merge the two tests into damon_test_call().
- Drop the list_empty()/call_controls.next expectations.
- Drop list_del() on the stack-allocated control.
- Post as a single patch.
mm/damon/tests/core-kunit.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
mm/damon/tests/core-kunit.h +22 -0
@@ -2724,6 +2724,27 @@ static void damos_test_sz_ops_filter_passed_last(struct kunit *test)damon_destroy_ctx (c); } +static void damon_test_call (struct kunit *test) +{ +struct damon_ctx *ctx; +struct damon_call_control control = {}; +int ret; + + ctx =damon_new_ctx (); +if (!ctx) +kunit_skip (test,"ctx alloc fail" ); + + ret =damon_call (ctx, &control); +KUNIT_EXPECT_EQ (test, ret, -ECANCELED ); + + ctx->call_controls_obsolete = false; + control.repeat = true; + ret =damon_call (ctx, &control); +KUNIT_EXPECT_EQ (test, ret,0 ); + +damon_destroy_ctx (ctx); +} +static struct kunit_case damon_test_cases[] = {KUNIT_CASE (damon_test_target),KUNIT_CASE (damon_test_regions),
@@ -2771,6 +2792,7 @@ static struct kunit_case damon_test_cases[] = {KUNIT_CASE (damos_test_esz_goal_temporal),KUNIT_CASE (damon_test_last_region_quota_reset),KUNIT_CASE (damos_test_sz_ops_filter_passed_last), + KUNIT_CASE(damon_test_call), {}, };
Signature · 1 line
2.47.3
[email protected]
AI reviewSashiko has reviewed this 4-patch series and found no issues.
Sashiko has reviewed this 4-patch series and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]
+ mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout.patch added to mm-new branch
In reply to SJ ParkThe patch titled Subject: mm/damon/paddr: skip non-LRU folios as a whole in pageout has been added to the -mm mm-new branch. Its filename is…
The patch titled
Subject: mm/damon/paddr: skip non-LRU folios as a whole in pageout
has been added to the -mm mm-new branch. Its filename is
mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
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 various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Aveline Noir <[email protected]>
Subject: mm/damon/paddr: skip non-LRU folios as a whole in pageout
Date: Tue, 24 Nov 2026 07:30:17 -0800
Patch series "mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit".
Improve efficiency of DAMOS_PAGEOUT in paddr and apply_probes() in core by skipping unnecessary operations, via patches 1 and 2 from Aveline Noir. Fix a selftest for a false positive failure, via patch 3 from Aveline Noir. Add a kunit test for damon_call(), via patch 4 from Sailesh Nandanavanam.
This is a batched reposting of separately posted and reviewed patches for being merged into the mm.git. Refer to changelog on each patch for changes that were made before this reposting.
This patch (of 4):
damon_pa_pageout() uses damon_get_folio(), which rejects folios that are not on the LRU. For a large non-LRU folio such as a hugetlb folio, the loop then looks up the same folio once per base page even though pageout cannot reclaim it.
Use damon_get_monitor_folio() and skip any returned non-LRU folio as a whole by advancing to its end. Do this before the filters, the accounting and the last_applied check, so that adjacent regions within the same non-LRU folio are not walked by base page either.
In an x86-64 KVM pageout microbenchmark, traversal time dropped by about 99.7% for regions covering whole 2 MiB hugetlb folios. For 4 KiB regions within hugetlb folios, traversal took about 1 ns more per region.
mm/damon/paddr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/damon/paddr.c renamed from mm/damon/paddr.c~mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout +3 -1
@@ -268,7 +268,9 @@ static unsigned long damon_pa_pageout(st addr =damon_pa_phys_addr (r->ar.start, addr_unit);while (addr <damon_pa_phys_addr (r->ar.end, addr_unit)) { - folio =damon_get_folio (PHYS_PFN (addr)); + folio =damon_get_monitor_folio (PHYS_PFN (addr)); +if (folio && !folio_test_lru (folio)) + goto put_folio;if (damon_pa_invalid_damos_folio (folio, s)) { addr +=PAGE_SIZE ;continue ;
_
Patches currently in -mm which might be from [email protected] are
mm-damon-ops-common-align-mmu-notifier-range-when-clearing-pmd-young-bit.patch mm-damon-stat-avoid-32-bit-overflow-in-idle-percentiles.patch mm-damon-pvaddr-skip-folios-already-on-the-migration-target-node.patch docs-admin-guide-mm-damon-start-fix-grammar.patch docs-admin-guide-mm-damon-stat-fix-pronoun-agreement.patch docs-admin-guide-mm-damon-usage-fix-grammar.patch docs-admin-guide-mm-damon-lru_sort-fix-remaining-grammar.patch docs-mm-damon-design-fix-grammar-and-typos.patch docs-mm-damon-api-fix-verb-form.patch docs-mm-damon-maintainer-profile-fix-subject-verb-agreement.patch docs-mm-damon-monitoring_intervals_tuning_example-fix-grammar-and-typos.patch mm-damon-paddr-add-kunit-tests-for-addr_unit-conversion.patch mm-damon-paddr-add-kunit-tests-for-addr_unit-conversion-fix.patch mm-hmm-account-for-subpage-offsets-in-device-private-pmds.patch mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout.patch mm-damon-core-skip-apply_probes-when-no-probes-are-installed.patch selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds.patch
+ mm-damon-core-skip-apply_probes-when-no-probes-are-installed.patch added to mm-new branch
In reply to SJ ParkThe patch titled Subject: mm/damon/core: skip apply_probes() when no probes are installed has been added to the -mm mm-new branch. Its filename is…
The patch titled
Subject: mm/damon/core: skip apply_probes() when no probes are installed
has been added to the -mm mm-new branch. Its filename is
mm-damon-core-skip-apply_probes-when-no-probes-are-installed.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-core-skip-apply_probes-when-no-probes-are-installed.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
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 various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Aveline Noir <[email protected]>
Subject: mm/damon/core: skip apply_probes() when no probes are installed
Date: Tue, 24 Nov 2026 07:30:18 -0800
While measuring vaddr monitoring overhead, I noticed that kdamond calls apply_probes() every sampling interval even if no probes are installed. The vaddr callback walks the page tables for each region's sample, and paddr looks up a folio and takes a reference if it can. There are no probe hits to count in either case.
Skip the callback when the probe list is empty. Ordinary access checks still run, and installed probes with zero weight are still applied.
mm/damon/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/core.c renamed from mm/damon/core.c~mm-damon-core-skip-apply_probes-when-no-probes-are-installed +1 -1
@@ -4105,7 +4105,7 @@ static int kdamond_fn(void *data)if (!access_check_disabled && ctx->ops.check_accesses) max_merge_score = ctx->ops.check_accesses (ctx); -if (ctx->ops.apply_probes) { +if (ctx->ops.apply_probes && !list_empty (&ctx->probes)) {if (time_after_eq (ctx->passed_sample_intervals, next_aggregation_sis) && access_check_disabled)
_
Patches currently in -mm which might be from [email protected] are
mm-damon-ops-common-align-mmu-notifier-range-when-clearing-pmd-young-bit.patch mm-damon-stat-avoid-32-bit-overflow-in-idle-percentiles.patch mm-damon-pvaddr-skip-folios-already-on-the-migration-target-node.patch docs-admin-guide-mm-damon-start-fix-grammar.patch docs-admin-guide-mm-damon-stat-fix-pronoun-agreement.patch docs-admin-guide-mm-damon-usage-fix-grammar.patch docs-admin-guide-mm-damon-lru_sort-fix-remaining-grammar.patch docs-mm-damon-design-fix-grammar-and-typos.patch docs-mm-damon-api-fix-verb-form.patch docs-mm-damon-maintainer-profile-fix-subject-verb-agreement.patch docs-mm-damon-monitoring_intervals_tuning_example-fix-grammar-and-typos.patch mm-damon-paddr-add-kunit-tests-for-addr_unit-conversion.patch mm-damon-paddr-add-kunit-tests-for-addr_unit-conversion-fix.patch mm-hmm-account-for-subpage-offsets-in-device-private-pmds.patch mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout.patch mm-damon-core-skip-apply_probes-when-no-probes-are-installed.patch selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds.patch
+ selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds.patch added to mm-new branch
In reply to SJ ParkThe patch titled Subject: selftests/damon/damos_quota: skip the last sample when counting exceeds has been added to the -mm mm-new branch. Its filename is…
The patch titled
Subject: selftests/damon/damos_quota: skip the last sample when counting exceeds
has been added to the -mm mm-new branch. Its filename is
selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
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 various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Aveline Noir <[email protected]>
Subject: selftests/damon/damos_quota: skip the last sample when counting exceeds
Date: Tue, 24 Nov 2026 07:30:19 -0800
damos_quota.py expects qt_exceeds to be increased for every sample whose tried_bytes equals the quota. The kernel increases it only when the next quota window starts, so the last full window may still be pending when the workload exits. The test then fails with an expected count one higher than the actual one, e.g., 15 < 16.
Do not count the last sample. Also drop the sorting of the samples, so that the last one is the latest.
tools/testing/selftests/damon/damos_quota.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
tools/testing/selftests/damon/damos_quota.py renamed from tools/testing/selftests/damon/damos_quota.py~selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds +4 -3
@@ -53,15 +53,16 @@ def main(): wss_collected.append(scheme.tried_bytes) nr_quota_exceeds = scheme.stats.qt_exceeds - wss_collected.sort() nr_expected_quota_exceeds = 0 - for wss in wss_collected: + for idx, wss in enumerate(wss_collected): if wss > sz_quota: print('quota is not kept: %s > %s' % (wss, sz_quota)) print('collected samples are as below') print('\n'.join(['%d' % wss for wss in wss_collected])) exit(1) - if wss == sz_quota: + # qt_exceeds is updated when the next quota window starts, so skip + # the last sample, whose window may still be pending. + if wss == sz_quota and idx < len(wss_collected) - 1: nr_expected_quota_exceeds += 1 if nr_quota_exceeds < nr_expected_quota_exceeds:
_
Patches currently in -mm which might be from [email protected] are
mm-damon-ops-common-align-mmu-notifier-range-when-clearing-pmd-young-bit.patch mm-damon-stat-avoid-32-bit-overflow-in-idle-percentiles.patch mm-damon-pvaddr-skip-folios-already-on-the-migration-target-node.patch docs-admin-guide-mm-damon-start-fix-grammar.patch docs-admin-guide-mm-damon-stat-fix-pronoun-agreement.patch docs-admin-guide-mm-damon-usage-fix-grammar.patch docs-admin-guide-mm-damon-lru_sort-fix-remaining-grammar.patch docs-mm-damon-design-fix-grammar-and-typos.patch docs-mm-damon-api-fix-verb-form.patch docs-mm-damon-maintainer-profile-fix-subject-verb-agreement.patch docs-mm-damon-monitoring_intervals_tuning_example-fix-grammar-and-typos.patch mm-damon-paddr-add-kunit-tests-for-addr_unit-conversion.patch mm-damon-paddr-add-kunit-tests-for-addr_unit-conversion-fix.patch mm-hmm-account-for-subpage-offsets-in-device-private-pmds.patch mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout.patch mm-damon-core-skip-apply_probes-when-no-probes-are-installed.patch selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds.patch
+ mm-damon-tests-core-kunit-add-test-for-damon_call.patch added to mm-new branch
In reply to SJ ParkThe patch titled Subject: mm/damon/tests/core-kunit: add test for damon_call() has been added to the -mm mm-new branch. Its filename is mm-damon-tests-core-kunit-add-test-for-damon_call.patch
The patch titled
Subject: mm/damon/tests/core-kunit: add test for damon_call()
has been added to the -mm mm-new branch. Its filename is
mm-damon-tests-core-kunit-add-test-for-damon_call.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-tests-core-kunit-add-test-for-damon_call.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
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 various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Sailesh Nandanavanam <[email protected]>
Subject: mm/damon/tests/core-kunit: add test for damon_call()
Date: Tue, 24 Nov 2026 07:30:20 -0800
A newly allocated damon_ctx has call_controls_obsolete set, meaning no kdamond is available to handle call requests. damon_call() should return -ECANCELED in that case instead of queueing the request and waiting forever. When call_controls_obsolete is unset and damon_call_control->repeat is set, damon_call() should return 0 without waiting for kdamond. Add a kunit test for the two cases.
mm/damon/tests/core-kunit.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
mm/damon/tests/core-kunit.h renamed from mm/damon/tests/core-kunit.h~mm-damon-tests-core-kunit-add-test-for-damon_call +22 -0
@@ -2724,6 +2724,27 @@ static void damos_test_sz_ops_filter_pasdamon_destroy_ctx (c); } +static void damon_test_call (struct kunit *test) +{ +struct damon_ctx *ctx; +struct damon_call_control control = {}; +int ret; + + ctx =damon_new_ctx (); +if (!ctx) +kunit_skip (test,"ctx alloc fail" ); + + ret =damon_call (ctx, &control); +KUNIT_EXPECT_EQ (test, ret, -ECANCELED ); + + ctx->call_controls_obsolete = false; + control.repeat = true; + ret =damon_call (ctx, &control); +KUNIT_EXPECT_EQ (test, ret,0 ); + +damon_destroy_ctx (ctx); +} +static struct kunit_case damon_test_cases[] = {KUNIT_CASE (damon_test_target),KUNIT_CASE (damon_test_regions),
@@ -2771,6 +2792,7 @@ static struct kunit_case damon_test_caseKUNIT_CASE (damos_test_esz_goal_temporal),KUNIT_CASE (damon_test_last_region_quota_reset),KUNIT_CASE (damos_test_sz_ops_filter_passed_last), + KUNIT_CASE(damon_test_call), {}, };
_
Patches currently in -mm which might be from [email protected] are
mm-damon-tests-core-kunit-add-test-for-damon_call.patch