[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250622210330.40490-5-sj@kernel.org>
Date: Sun, 22 Jun 2025 14:03:28 -0700
From: SeongJae Park <sj@...nel.org>
To:
Cc: SeongJae Park <sj@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Shuah Khan <shuah@...nel.org>,
damon@...ts.linux.dev,
kernel-team@...a.com,
linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
linux-mm@...ck.org
Subject: [RFC PATCH 4/6] selftests/damon/sysfs.py: test monitoring attribute parameters
Add DAMON sysfs interface functionality tests for DAMON monitoring
attribute parameters, including intervals, intervals tuning goals, and
min/max number of regions.
Signed-off-by: SeongJae Park <sj@...nel.org>
---
tools/testing/selftests/damon/sysfs.py | 34 ++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftests/damon/sysfs.py
index 4ff99db0d247..a721901a880d 100755
--- a/tools/testing/selftests/damon/sysfs.py
+++ b/tools/testing/selftests/damon/sysfs.py
@@ -20,6 +20,11 @@ def dump_damon_status_dict(pid):
except Exception as e:
return None, 'json.load fail (%s)' % e
+def fail(expectation, status):
+ print('unexpected %s' % expectation)
+ print(json.dumps(status, indent=4))
+ exit(1)
+
def main():
kdamonds = _damon_sysfs.Kdamonds(
[_damon_sysfs.Kdamond(contexts=[_damon_sysfs.DamonCtx()])])
@@ -34,8 +39,33 @@ def main():
exit(1)
if len(status['contexts']) != 1:
- print('number of contexts: %d' % len(status['contexts']))
- exit(1)
+ fail('number of contexts', status)
+
+ ctx = status['contexts'][0]
+ attrs = ctx['attrs']
+ if attrs['sample_interval'] != 5000:
+ fail('sample interval', status)
+ if attrs['aggr_interval'] != 100000:
+ fail('aggr interval', status)
+ if attrs['ops_update_interval'] != 1000000:
+ fail('ops updte interval', status)
+
+ if attrs['intervals_goal'] != {
+ 'access_bp': 0, 'aggrs': 0,
+ 'min_sample_us': 0, 'max_sample_us': 0}:
+ fail('intervals goal')
+
+ if attrs['min_nr_regions'] != 10:
+ fail('min_nr_regions')
+ if attrs['max_nr_regions'] != 1000:
+ fail('max_nr_regions')
+
+ if ctx['adaptive_targets'] != []:
+ fail('adaptive_targets')
+
+ if ctx['schemes'] != []:
+ fail('schemes')
+
kdamonds.stop()
if __name__ == '__main__':
--
2.39.5
Powered by blists - more mailing lists