[PATCH 0/7] mm/damon: improve/fixup/update ratio calculation, test and documentation

0 views
Skip to first unread message

SeongJae Park

unread,
Mar 7, 2026, 2:54:09 PM (13 days ago) Mar 7
to Andrew Morton, SeongJae Park, Liam R. Howlett, Brendan Higgins, David Gow, David Hildenbrand, Jonathan Corbet, Lorenzo Stoakes, Michal Hocko, Mike Rapoport, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka, da...@lists.linux.dev, kuni...@googlegroups.com, linu...@vger.kernel.org, linux-...@vger.kernel.org, linux-k...@vger.kernel.org, linu...@kvack.org, wang lian
Yet another batch of misc/minor improvements and fixups. Use
mult_frac() instead of the worse open-coding for rate calculations
(patch 1). Add a test for a previously found and fixed bug (patch 2).
Improve and update comments and documentations for easier code review
and up-to-date information (patches 3-6). Finally, fix an obvious typo
(patch 7).

SeongJae Park (7):
mm/damon/core: use mult_frac()
mm/damon/tests/core-kunit: add a test for damon_is_last_region()
mm/damon/core: clarify damon_set_attrs() usages
mm/damon: document non-zero length damon_region assumption
Docs/admin-guide/mm/damn/lru_sort: fix intervals autotune parameter
name
Docs/mm/damon/maintainer-profile: use flexible review cadence
Docs/mm/damon/index: fix typo: autoamted -> automated

.../admin-guide/mm/damon/lru_sort.rst | 4 +--
Documentation/mm/damon/index.rst | 2 +-
Documentation/mm/damon/maintainer-profile.rst | 8 ++---
include/linux/damon.h | 2 ++
mm/damon/core.c | 32 ++++++++++++-------
mm/damon/tests/core-kunit.h | 23 +++++++++++++
6 files changed, 52 insertions(+), 19 deletions(-)


base-commit: fa1e30b2dede645519bf6743439d3925922651bc
--
2.47.3

SeongJae Park

unread,
Mar 7, 2026, 2:54:09 PM (13 days ago) Mar 7
to Andrew Morton, SeongJae Park, Brendan Higgins, David Gow, da...@lists.linux.dev, kuni...@googlegroups.com, linux-...@vger.kernel.org, linux-k...@vger.kernel.org, linu...@kvack.org
There was a bug [1] in damon_is_last_region(). Add a kunit test to not
reintroduce the bug.

[1] https://lore.kernel.org/202601141520...@kernel.org/

Signed-off-by: SeongJae Park <s...@kernel.org>
---
mm/damon/tests/core-kunit.h | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index 2289f9e4610c0..e86d4f4fe261a 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -1311,6 +1311,28 @@ static void damon_test_apply_min_nr_regions(struct kunit *test)
damon_test_apply_min_nr_regions_for(test, 10, 2, 10, 2, 5);
}

+static void damon_test_is_last_region(struct kunit *test)
+{
+ struct damon_region *r;
+ struct damon_target *t;
+ int i;
+
+ t = damon_new_target();
+ if (!t)
+ kunit_skip(test, "target alloc fail\n");
+
+ for (i = 0; i < 4; i++) {
+ r = damon_new_region(i * 2, (i + 1) * 2);
+ if (!r) {
+ damon_free_target(t);
+ kunit_skip(test, "region alloc %d fail\n", i);
+ }
+ damon_add_region(r, t);
+ KUNIT_EXPECT_TRUE(test, damon_is_last_region(r, t));
+ }
+ damon_free_target(t);
+}
+
static struct kunit_case damon_test_cases[] = {
KUNIT_CASE(damon_test_target),
KUNIT_CASE(damon_test_regions),
@@ -1339,6 +1361,7 @@ static struct kunit_case damon_test_cases[] = {
KUNIT_CASE(damon_test_feed_loop_next_input),
KUNIT_CASE(damon_test_set_filters_default_reject),
KUNIT_CASE(damon_test_apply_min_nr_regions),
+ KUNIT_CASE(damon_test_is_last_region),
{},
};

--
2.47.3

wang lian

unread,
Mar 8, 2026, 10:28:33 PM (12 days ago) Mar 8
to s...@kernel.org, Liam.H...@oracle.com, ak...@linux-foundation.org, brendan...@linux.dev, cor...@lwn.net, da...@lists.linux.dev, da...@kernel.org, davi...@google.com, kuni...@googlegroups.com, lian...@gmail.com, linu...@vger.kernel.org, linux-...@vger.kernel.org, linux-k...@vger.kernel.org, linu...@kvack.org, l...@kernel.org, mho...@suse.com, rp...@kernel.org, sk...@linuxfoundation.org, sur...@google.com, vba...@kernel.org
> Yet another batch of misc/minor improvements and fixups. Use
> mult_frac() instead of the worse open-coding for rate calculations
> (patch 1). Add a test for a previously found and fixed bug (patch 2).
> Improve and update comments and documentations for easier code review
> and up-to-date information (patches 3-6). Finally, fix an obvious typo
> (patch 7).

Hi SeongJae,

Thanks for the patches and the CC!

I've reviewed the entire series and conducted functional testing on my arm64 environment (native VM).
All 28 KUnit tests passed successfully, including
the newly added damon_test_is_last_region.

Acked-by: wang lian <lian...@gmail.com>
--
Best Regards,
wang lian

wang lian

unread,
Mar 8, 2026, 10:34:48 PM (12 days ago) Mar 8
to s...@kernel.org, ak...@linux-foundation.org, brendan...@linux.dev, da...@lists.linux.dev, davi...@google.com, kuni...@googlegroups.com, linux-...@vger.kernel.org, linux-k...@vger.kernel.org, linu...@kvack.org, wang lian
> There was a bug [1] in damon_is_last_region(). Add a kunit test to not
> reintroduce the bug.

> [1] https://lore.kernel.org/202601141520...@kernel.org/

> Signed-off-by: SeongJae Park <s...@kernel.org>

Hi SeongJae,

I've been following the previous discussion regarding the bug in
damon_is_last_region() where the arguments of list_is_last() were
accidentally swapped.

I have verified this patch by running the KUnit tests on my arm64 native
environment. The damon_test_is_last_region test case passed as expected,
confirming that the fix is robust and the regression is effectively
prevented.

Tested-by: wang lian <lian...@gmail.com>
Reviewed-by: wang lian <lian...@gmail.com>
Reply all
Reply to author
Forward
0 new messages