]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/damon/_damon_sysfs: support DAMOS quota goal nid setup
authorSeongJae Park <sj@kernel.org>
Sun, 20 Jul 2025 17:16:35 +0000 (10:16 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 26 Jul 2025 22:08:17 +0000 (15:08 -0700)
_damon_sysfs.py contains code for test-purpose DAMON sysfs interface
control.  Add support of DAMOS quota goal nid setup for more tests.

Link: https://lkml.kernel.org/r/20250720171652.92309-6-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>
tools/testing/selftests/damon/_damon_sysfs.py

index 12d076260b2b1a3588e8f256e7579c113b3daec9..23de9202b4e360bed1892b3ef0f98bc4965c157a 100644 (file)
@@ -93,14 +93,16 @@ class DamosQuotaGoal:
     metric = None
     target_value = None
     current_value = None
+    nid = None
     effective_bytes = None
     quota = None            # owner quota
     idx = None
 
-    def __init__(self, metric, target_value=10000, current_value=0):
+    def __init__(self, metric, target_value=10000, current_value=0, nid=0):
         self.metric = metric
         self.target_value = target_value
         self.current_value = current_value
+        self.nid = nid
 
     def sysfs_dir(self):
         return os.path.join(self.quota.sysfs_dir(), 'goals', '%d' % self.idx)
@@ -118,6 +120,10 @@ class DamosQuotaGoal:
                          self.current_value)
         if err is not None:
             return err
+        err = write_file(os.path.join(self.sysfs_dir(), 'nid'), self.nid)
+        if err is not None:
+            return err
+
         return None
 
 class DamosQuota: