* [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit
@ 2026-11-24 15:30 SJ Park
2026-11-24 15:30 ` [PATCH 1/4] mm/damon/paddr: skip non-LRU folios as a whole in pageout SJ Park
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: SJ Park @ 2026-11-24 15:30 UTC (permalink / raw)
To: Andrew Morton
Cc: SJ Park, Brendan Higgins, David Gow, Shuah Khan, Shuah Khan,
damon, kunit-dev, linux-kselftest, linux-mm
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
--
2.47.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] mm/damon/paddr: skip non-LRU folios as a whole in pageout
2026-11-24 15:30 [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit SJ Park
@ 2026-11-24 15:30 ` SJ Park
2026-11-24 17:16 ` + mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout.patch added to mm-new branch Andrew Morton
2026-11-24 15:30 ` [PATCH 2/4] mm/damon/core: skip apply_probes() when no probes are installed SJ Park
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: SJ Park @ 2026-11-24 15:30 UTC (permalink / raw)
To: Andrew Morton; +Cc: Aveline Noir, SJ Park, damon, linux-mm, Enze Li
From: Aveline Noir <jm5905938@gmail.com>
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.
Signed-off-by: Aveline Noir <jm5905938@gmail.com>
Reviewed-by: Enze Li <lienze@kylinos.cn>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
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(-)
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index 411e1d557ba3f..83bc173c30504 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -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;
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] mm/damon/core: skip apply_probes() when no probes are installed
2026-11-24 15:30 [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit SJ Park
2026-11-24 15:30 ` [PATCH 1/4] mm/damon/paddr: skip non-LRU folios as a whole in pageout SJ Park
@ 2026-11-24 15:30 ` SJ Park
2026-11-24 17:16 ` + mm-damon-core-skip-apply_probes-when-no-probes-are-installed.patch added to mm-new branch Andrew Morton
2026-11-24 15:30 ` [PATCH 3/4] selftests/damon/damos_quota: skip the last sample when counting exceeds SJ Park
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: SJ Park @ 2026-11-24 15:30 UTC (permalink / raw)
To: Andrew Morton; +Cc: Aveline Noir, SJ Park, damon, linux-mm
From: Aveline Noir <jm5905938@gmail.com>
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.
Signed-off-by: Aveline Noir <jm5905938@gmail.com>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
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(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 649a4ac968abf..74058af5567fe 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -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)
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] selftests/damon/damos_quota: skip the last sample when counting exceeds
2026-11-24 15:30 [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit SJ Park
2026-11-24 15:30 ` [PATCH 1/4] mm/damon/paddr: skip non-LRU folios as a whole in pageout SJ Park
2026-11-24 15:30 ` [PATCH 2/4] mm/damon/core: skip apply_probes() when no probes are installed SJ Park
@ 2026-11-24 15:30 ` SJ Park
2026-11-24 17:16 ` + selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds.patch added to mm-new branch Andrew Morton
2026-11-24 15:30 ` [PATCH 4/4] mm/damon/tests/core-kunit: add test for damon_call() SJ Park
2026-11-24 15:39 ` [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit sashiko-bot
4 siblings, 1 reply; 10+ messages in thread
From: SJ Park @ 2026-11-24 15:30 UTC (permalink / raw)
To: Andrew Morton
Cc: Aveline Noir, SJ Park, Shuah Khan, Shuah Khan, damon,
linux-kselftest, linux-mm
From: Aveline Noir <jm5905938@gmail.com>
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.
Cc: Shuah Khan <shuah@kernel.org>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Aveline Noir <jm5905938@gmail.com>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
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(-)
diff --git a/tools/testing/selftests/damon/damos_quota.py b/tools/testing/selftests/damon/damos_quota.py
index 879115a499bf8..bdfd22f000795 100755
--- a/tools/testing/selftests/damon/damos_quota.py
+++ b/tools/testing/selftests/damon/damos_quota.py
@@ -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:
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] mm/damon/tests/core-kunit: add test for damon_call()
2026-11-24 15:30 [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit SJ Park
` (2 preceding siblings ...)
2026-11-24 15:30 ` [PATCH 3/4] selftests/damon/damos_quota: skip the last sample when counting exceeds SJ Park
@ 2026-11-24 15:30 ` SJ Park
2026-11-24 17:16 ` + mm-damon-tests-core-kunit-add-test-for-damon_call.patch added to mm-new branch Andrew Morton
2026-11-24 15:39 ` [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit sashiko-bot
4 siblings, 1 reply; 10+ messages in thread
From: SJ Park @ 2026-11-24 15:30 UTC (permalink / raw)
To: Andrew Morton
Cc: Sailesh Nandanavanam, Brendan Higgins, David Gow, SJ Park, damon,
kunit-dev, linux-kselftest, linux-mm, Aveline Noir
From: Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
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.
Signed-off-by: Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
Tested-by: Aveline Noir <jm5905938@gmail.com>
Reviewed-by: Aveline Noir <jm5905938@gmail.com>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
Changes from v2
- v2: https://lore.kernel.org/20261118063755.37749-1-saileshnandanavanam@gmail.com
- Collect R-b: from SJ.
- Rebase to the latest mm-new.
Changes from v1
(https://lore.kernel.org/20261117172219.26725-1-saileshnandanavanam@gmail.com,
https://lore.kernel.org/20261117174834.29182-1-saileshnandanavanam@gmail.com)
- 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(+)
diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index a27545602680a..4446574a35652 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -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),
{},
};
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit
2026-11-24 15:30 [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit SJ Park
` (3 preceding siblings ...)
2026-11-24 15:30 ` [PATCH 4/4] mm/damon/tests/core-kunit: add test for damon_call() SJ Park
@ 2026-11-24 15:39 ` sashiko-bot
4 siblings, 0 replies; 10+ messages in thread
From: sashiko-bot @ 2026-11-24 15:39 UTC (permalink / raw)
To: SJ Park; +Cc: damon
Sashiko has reviewed this 4-patch series and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124153021.90142-1-sj@kernel.org
^ permalink raw reply [flat|nested] 10+ messages in thread
* + mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout.patch added to mm-new branch
2026-11-24 15:30 ` [PATCH 1/4] mm/damon/paddr: skip non-LRU folios as a whole in pageout SJ Park
@ 2026-11-24 17:16 ` Andrew Morton
0 siblings, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2026-11-24 17:16 UTC (permalink / raw)
To: mm-commits, sj, saileshnandanavanam, lienze, jm5905938, akpm
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 <jm5905938@gmail.com>
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.
Link: https://lore.kernel.org/20261124153021.90142-1-sj@kernel.org
Link: https://patch.msgid.link/20261124153021.90142-2-sj@kernel.org
Signed-off-by: Aveline Noir <jm5905938@gmail.com>
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Enze Li <lienze@kylinos.cn>
Reviewed-by: SJ Park <sj@kernel.org>
Cc: Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
mm/damon/paddr.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/mm/damon/paddr.c~mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout
+++ a/mm/damon/paddr.c
@@ -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 jm5905938@gmail.com 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* + mm-damon-core-skip-apply_probes-when-no-probes-are-installed.patch added to mm-new branch
2026-11-24 15:30 ` [PATCH 2/4] mm/damon/core: skip apply_probes() when no probes are installed SJ Park
@ 2026-11-24 17:16 ` Andrew Morton
0 siblings, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2026-11-24 17:16 UTC (permalink / raw)
To: mm-commits, sj, saileshnandanavanam, lienze, jm5905938, akpm
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 <jm5905938@gmail.com>
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.
Link: https://patch.msgid.link/20261124153021.90142-3-sj@kernel.org
Signed-off-by: Aveline Noir <jm5905938@gmail.com>
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: SJ Park <sj@kernel.org>
Cc: Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
Cc: Enze Li <lienze@kylinos.cn>
mm/damon/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/damon/core.c~mm-damon-core-skip-apply_probes-when-no-probes-are-installed
+++ a/mm/damon/core.c
@@ -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 jm5905938@gmail.com 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* + selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds.patch added to mm-new branch
2026-11-24 15:30 ` [PATCH 3/4] selftests/damon/damos_quota: skip the last sample when counting exceeds SJ Park
@ 2026-11-24 17:16 ` Andrew Morton
0 siblings, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2026-11-24 17:16 UTC (permalink / raw)
To: mm-commits, sj, shuah, saileshnandanavanam, lienze, jm5905938,
akpm
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 <jm5905938@gmail.com>
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.
Link: https://patch.msgid.link/20261124153021.90142-4-sj@kernel.org
Signed-off-by: Aveline Noir <jm5905938@gmail.com>
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: SJ Park <sj@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
Cc: Enze Li <lienze@kylinos.cn>
tools/testing/selftests/damon/damos_quota.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/tools/testing/selftests/damon/damos_quota.py~selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds
+++ a/tools/testing/selftests/damon/damos_quota.py
@@ -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 jm5905938@gmail.com 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* + mm-damon-tests-core-kunit-add-test-for-damon_call.patch added to mm-new branch
2026-11-24 15:30 ` [PATCH 4/4] mm/damon/tests/core-kunit: add test for damon_call() SJ Park
@ 2026-11-24 17:16 ` Andrew Morton
0 siblings, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2026-11-24 17:16 UTC (permalink / raw)
To: mm-commits, sj, lienze, jm5905938, davidgow, brendan.higgins,
saileshnandanavanam, akpm
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 <saileshnandanavanam@gmail.com>
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.
Link: https://patch.msgid.link/20261124153021.90142-5-sj@kernel.org
Signed-off-by: Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Tested-by: Aveline Noir <jm5905938@gmail.com>
Reviewed-by: Aveline Noir <jm5905938@gmail.com>
Reviewed-by: SJ Park <sj@kernel.org>
Cc: Brendan Higgins <brendan.higgins@linux.dev>
Cc: David Gow <davidgow@davidgow.net>
Cc: Enze Li <lienze@kylinos.cn>
mm/damon/tests/core-kunit.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
--- a/mm/damon/tests/core-kunit.h~mm-damon-tests-core-kunit-add-test-for-damon_call
+++ a/mm/damon/tests/core-kunit.h
@@ -2724,6 +2724,27 @@ static void damos_test_sz_ops_filter_pas
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_case
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),
{},
};
_
Patches currently in -mm which might be from saileshnandanavanam@gmail.com are
mm-damon-tests-core-kunit-add-test-for-damon_call.patch
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-11-24 17:16 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 15:30 [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit SJ Park
2026-11-24 15:30 ` [PATCH 1/4] mm/damon/paddr: skip non-LRU folios as a whole in pageout SJ Park
2026-11-24 17:16 ` + mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout.patch added to mm-new branch Andrew Morton
2026-11-24 15:30 ` [PATCH 2/4] mm/damon/core: skip apply_probes() when no probes are installed SJ Park
2026-11-24 17:16 ` + mm-damon-core-skip-apply_probes-when-no-probes-are-installed.patch added to mm-new branch Andrew Morton
2026-11-24 15:30 ` [PATCH 3/4] selftests/damon/damos_quota: skip the last sample when counting exceeds SJ Park
2026-11-24 17:16 ` + selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds.patch added to mm-new branch Andrew Morton
2026-11-24 15:30 ` [PATCH 4/4] mm/damon/tests/core-kunit: add test for damon_call() SJ Park
2026-11-24 17:16 ` + mm-damon-tests-core-kunit-add-test-for-damon_call.patch added to mm-new branch Andrew Morton
2026-11-24 15:39 ` [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.