From: SeongJae Park <sj@kernel.org>
Cc: SeongJae Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>,
damon@lists.linux.dev, kernel-team@meta.com,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-mm@kvack.org
Subject: [RFC PATCH 6/6] selftests/damon/sysfs.py: test DAMOS schemes parameters setup
Date: Sun, 22 Jun 2025 14:03:30 -0700 [thread overview]
Message-ID: <20250622210330.40490-7-sj@kernel.org> (raw)
In-Reply-To: <20250622210330.40490-1-sj@kernel.org>
Add DAMON sysfs interface functionality tests for basic DAMOS schemes
parameters setup.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
tools/testing/selftests/damon/sysfs.py | 46 ++++++++++++++++++++++++--
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftests/damon/sysfs.py
index 3b085268f342..e67008fd055d 100755
--- a/tools/testing/selftests/damon/sysfs.py
+++ b/tools/testing/selftests/damon/sysfs.py
@@ -29,7 +29,9 @@ def main():
kdamonds = _damon_sysfs.Kdamonds(
[_damon_sysfs.Kdamond(
contexts=[_damon_sysfs.DamonCtx(
- targets=[_damon_sysfs.DamonTarget(pid=-1)])])])
+ targets=[_damon_sysfs.DamonTarget(pid=-1)],
+ schemes=[_damon_sysfs.Damos()],
+ )])])
err = kdamonds.start()
if err is not None:
print('kdamond start failed: %s' % err)
@@ -66,8 +68,46 @@ def main():
{ 'pid': 0, 'nr_regions': 0, 'regions_list': []}]:
fail('adaptive targets', status)
- if ctx['schemes'] != []:
- fail('schemes')
+ if len(ctx['schemes']) != 1:
+ fail('number of schemes', status)
+
+ scheme = ctx['schemes'][0]
+ if scheme['pattern'] != {
+ 'min_sz_region': 0,
+ 'max_sz_region': 2**64 - 1,
+ 'min_nr_accesses': 0,
+ 'max_nr_accesses': 2**32 - 1,
+ 'min_age_region': 0,
+ 'max_age_region': 2**32 - 1,
+ }:
+ fail('damos pattern', status)
+ if scheme['action'] != 9: # stat
+ fail('damos action', status)
+ if scheme['apply_interval_us'] != 0:
+ fail('damos apply interval', status)
+ if scheme['target_nid'] != -1:
+ fail('damos target nid', status)
+
+ if scheme['quota'] != {
+ 'reset_interval': 0,
+ 'ms': 0,
+ 'sz': 0,
+ 'goals': [],
+ 'esz': 0,
+ 'weight_sz': 0,
+ 'weight_nr_accesses': 0,
+ 'weight_age': 0,
+ }:
+ fail('damos quota', status)
+
+ if scheme['wmarks'] != {
+ 'metric': 0,
+ 'interval': 0,
+ 'high': 0,
+ 'mid': 0,
+ 'low': 0,
+ }:
+ fail('damos wmarks', status)
kdamonds.stop()
--
2.39.5
prev parent reply other threads:[~2025-06-22 21:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-22 21:03 [RFC PATCH 0/6] selftests/damon: add python and drgn based DAMON sysfs functionality tests SeongJae Park
2025-06-22 21:03 ` [RFC PATCH 1/6] selftests/damon: add drgn script for extracting damon status SeongJae Park
2025-06-22 21:03 ` [RFC PATCH 2/6] selftests/damon/_damon_sysfs: set Kdamond.pid in start() SeongJae Park
2025-06-22 21:03 ` [RFC PATCH 3/6] selftests/damon: add python and drgn-based DAMON sysfs test SeongJae Park
2025-06-22 21:03 ` [RFC PATCH 4/6] selftests/damon/sysfs.py: test monitoring attribute parameters SeongJae Park
2025-06-22 21:03 ` [RFC PATCH 5/6] selftests/damon/sysfs.py: test adaptive targets parameter SeongJae Park
2025-06-22 21:03 ` SeongJae Park [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250622210330.40490-7-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).