Skip to content

Commit 62b7b1f

Browse files
sjp38akpm00
authored andcommitted
selftests/damon/sysfs.py: test non-default parameters runtime commit
sysfs.py is testing only the default and minimum DAMON parameters. Add another test case for more non-default additional DAMON parameters commitment on runtime. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: SeongJae Park <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 16797a5 commit 62b7b1f

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

tools/testing/selftests/damon/sysfs.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,59 @@ def main():
199199

200200
assert_ctxs_committed(kdamonds.kdamonds[0].contexts, status['contexts'])
201201

202+
context = _damon_sysfs.DamonCtx(
203+
monitoring_attrs=_damon_sysfs.DamonAttrs(
204+
sample_us=100000, aggr_us=2000000,
205+
intervals_goal=_damon_sysfs.IntervalsGoal(
206+
access_bp=400, aggrs=3, min_sample_us=5000,
207+
max_sample_us=10000000),
208+
update_us=2000000),
209+
schemes=[_damon_sysfs.Damos(
210+
action='pageout',
211+
access_pattern=_damon_sysfs.DamosAccessPattern(
212+
size=[4096, 2**10],
213+
nr_accesses=[3, 317],
214+
age=[5,71]),
215+
quota=_damon_sysfs.DamosQuota(
216+
sz=100*1024*1024, ms=100,
217+
goals=[_damon_sysfs.DamosQuotaGoal(
218+
metric='node_mem_used_bp',
219+
target_value=9950,
220+
nid=1)],
221+
reset_interval_ms=1500,
222+
weight_sz_permil=20,
223+
weight_nr_accesses_permil=200,
224+
weight_age_permil=1000),
225+
watermarks=_damon_sysfs.DamosWatermarks(
226+
metric = 'free_mem_rate', interval = 500000, # 500 ms
227+
high = 500, mid = 400, low = 50),
228+
target_nid=1,
229+
apply_interval_us=1000000,
230+
dests=_damon_sysfs.DamosDests(
231+
dests=[_damon_sysfs.DamosDest(id=1, weight=30),
232+
_damon_sysfs.DamosDest(id=0, weight=70)]),
233+
core_filters=[
234+
_damon_sysfs.DamosFilter(type_='addr', matching=True,
235+
allow=False, addr_start=42,
236+
addr_end=4242),
237+
],
238+
ops_filters=[
239+
_damon_sysfs.DamosFilter(type_='anon', matching=True,
240+
allow=True),
241+
],
242+
)])
243+
context.idx = 0
244+
context.kdamond = kdamonds.kdamonds[0]
245+
kdamonds.kdamonds[0].contexts = [context]
246+
kdamonds.kdamonds[0].commit()
247+
248+
status, err = dump_damon_status_dict(kdamonds.kdamonds[0].pid)
249+
if err is not None:
250+
print(err)
251+
exit(1)
252+
253+
assert_ctxs_committed(kdamonds.kdamonds[0].contexts, status['contexts'])
254+
202255
kdamonds.stop()
203256

204257
if __name__ == '__main__':

0 commit comments

Comments
 (0)