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