1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-12 01:20:14 +00:00

selftests/damon/sysfs.py: test DAMOS schemes parameters setup

Add DAMON sysfs interface functionality tests for basic DAMOS schemes
parameters setup.

Link: https://lkml.kernel.org/r/20250628160428.53115-7-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
SeongJae Park 2025-06-28 09:04:28 -07:00 committed by Andrew Morton
parent 7e6bcf354f
commit 603cb4aa09

View File

@ -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()