[RFC PATCH v2 08/10] selftests/damon/_damon_sysfs: support goal_tuner setup

SeongJae Park
2026-03-04T04:41:30Z

Add support of goal_tuner setup to the test-purpose DAMON sysfs
interface control helper, _damon_sysfs.py.

Signed-off-by: SeongJae Park <sj@kernel.org>
---
tools/testing/selftests/damon/_damon_sysfs.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/selftests/damon/_damon_sysfs.py
index 748778b563cd2..2b4df655d9fd0 100644
--- a/tools/testing/selftests/damon/_damon_sysfs.py
+++ b/tools/testing/selftests/damon/_damon_sysfs.py
@@ -130,15 +130,16 @@ class DamosQuota:
sz = None # size quota, in bytes
ms = None # time quota
goals = None # quota goals
+ goal_tuner = None # quota goal tuner
reset_interval_ms = None # quota reset interval
weight_sz_permil = None
weight_nr_accesses_permil = None
weight_age_permil = None
scheme = None # owner scheme

- def __init__(self, sz=0, ms=0, goals=None, reset_interval_ms=0,
- weight_sz_permil=0, weight_nr_accesses_permil=0,
- weight_age_permil=0):
+ def __init__(self, sz=0, ms=0, goals=None, goal_tuner='consist',
+ reset_interval_ms=0, weight_sz_permil=0,
+ weight_nr_accesses_permil=0, weight_age_permil=0):
self.sz = sz
self.ms = ms
self.reset_interval_ms = reset_interval_ms
@@ -146,6 +147,7 @@ class DamosQuota:
self.weight_nr_accesses_permil = weight_nr_accesses_permil
self.weight_age_permil = weight_age_permil
self.goals = goals if goals is not None else []
+ self.goal_tuner = goal_tuner
for idx, goal in enumerate(self.goals):
goal.idx = idx
goal.quota = self
@@ -191,6 +193,10 @@ class DamosQuota:
err = goal.stage()
if err is not None:
return err
+ err = write_file(
+ os.path.join(self.sysfs_dir(), 'goal_tuner'), self.goal_tuner)
+ if err is not None:
+ return err
return None

class DamosWatermarks:
--
2.47.3