Commit a8622625 authored by SeongJae Park's avatar SeongJae Park Committed by Andrew Morton

selftests/damon/_damon_sysfs: support DAMOS apply interval

Update the test-purpose DAMON sysfs control Python module to support DAMOS
apply interval.

Link: https://lkml.kernel.org/r/20240207203134.69976-4-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent a0f87454
...@@ -114,6 +114,7 @@ class Damos: ...@@ -114,6 +114,7 @@ class Damos:
action = None action = None
access_pattern = None access_pattern = None
quota = None quota = None
apply_interval_us = None
# todo: Support watermarks, stats, tried_regions # todo: Support watermarks, stats, tried_regions
idx = None idx = None
context = None context = None
...@@ -121,12 +122,13 @@ class Damos: ...@@ -121,12 +122,13 @@ class Damos:
stats = None stats = None
def __init__(self, action='stat', access_pattern=DamosAccessPattern(), def __init__(self, action='stat', access_pattern=DamosAccessPattern(),
quota=DamosQuota()): quota=DamosQuota(), apply_interval_us=0):
self.action = action self.action = action
self.access_pattern = access_pattern self.access_pattern = access_pattern
self.access_pattern.scheme = self self.access_pattern.scheme = self
self.quota = quota self.quota = quota
self.quota.scheme = self self.quota.scheme = self
self.apply_interval_us = apply_interval_us
def sysfs_dir(self): def sysfs_dir(self):
return os.path.join( return os.path.join(
...@@ -139,6 +141,11 @@ class Damos: ...@@ -139,6 +141,11 @@ class Damos:
err = self.access_pattern.stage() err = self.access_pattern.stage()
if err != None: if err != None:
return err return err
err = write_file(os.path.join(self.sysfs_dir(), 'apply_interval_us'),
'%d' % self.apply_interval_us)
if err != None:
return err
err = self.quota.stage() err = self.quota.stage()
if err != None: if err != None:
return err return err
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment