aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeongJae Park <sj38.park@gmail.com>2024-03-17 11:52:20 -0700
committerSeongJae Park <sj38.park@gmail.com>2024-03-17 11:52:20 -0700
commit92cba7facb9cece52b62edb6aeb59402b872d497 (patch)
tree158c979828e97cf6f12b0559006bbbba11ec4438
parent07b1a1360a0ddee780f39d008b0b90d7168093fa (diff)
downloaddamo-92cba7facb9cece52b62edb6aeb59402b872d497.tar.gz
_damon_dbgfs: Put callees closer to callers
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
-rw-r--r--_damon_dbgfs.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/_damon_dbgfs.py b/_damon_dbgfs.py
index 54486ce3..7a8fd6cf 100644
--- a/_damon_dbgfs.py
+++ b/_damon_dbgfs.py
@@ -65,12 +65,6 @@ def update_schemes_quota_effective_bytes(kdamond_idxs):
# for stage_kdamonds
-def get_target_ids_file():
- return os.path.join(get_damon_dir(), 'target_ids')
-
-def get_init_regions_file():
- return os.path.join(get_damon_dir(), 'init_regions')
-
# note that DAMON debugfs interface is deprecated[1], and hence newer DAMOS
# actions including _damon.damos_action_lru_prio and
# _damon.damos_action_lru_deprio are not supported.
@@ -139,15 +133,6 @@ def damos_to_debugfs_input(damos, intervals, quotas_wmarks_supported):
watermarks.mid_permil, watermarks.low_permil])
return scheme_input
-def get_schemes_file():
- return os.path.join(get_damon_dir(), 'schemes')
-
-def attr_str_ctx(damon_ctx):
- intervals = damon_ctx.intervals
- nr_regions = damon_ctx.nr_regions
- return '%d %d %d %d %d ' % (intervals.sample, intervals.aggr,
- intervals.ops_update, nr_regions.minimum, nr_regions.maximum)
-
def write_schemes(dir_path, schemes, intervals):
scheme_file_input_lines = []
for scheme in schemes:
@@ -186,6 +171,12 @@ def write_target(dir_path, target, target_has_pid):
return err
return None
+def attr_str_ctx(damon_ctx):
+ intervals = damon_ctx.intervals
+ nr_regions = damon_ctx.nr_regions
+ return '%d %d %d %d %d ' % (intervals.sample, intervals.aggr,
+ intervals.ops_update, nr_regions.minimum, nr_regions.maximum)
+
def write_kdamonds(dir_path, kdamonds):
if len(kdamonds) > 1:
raise Exception('Currently only <=one kdamond is supported')
@@ -371,6 +362,9 @@ def test_debugfs_file(path, input_str, expected):
return False
return passed
+def get_schemes_file():
+ return os.path.join(get_damon_dir(), 'schemes')
+
def test_debugfs_file_schemes(nr_fields):
input_str = ' '.join(['1'] * nr_fields)
expected = '%s 0 0\n' % input_str
@@ -383,6 +377,12 @@ def test_debugfs_file_schemes_stat_extended(nr_fields):
return test_debugfs_file(get_schemes_file(), input_str, expected)
+def get_target_ids_file():
+ return os.path.join(get_damon_dir(), 'target_ids')
+
+def get_init_regions_file():
+ return os.path.join(get_damon_dir(), 'init_regions')
+
def test_init_regions_version(paddr_supported):
# Save previous values
orig_target_ids, err = read_value_for_restore(get_target_ids_file())