Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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/20250720171652.92309-22-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>

authored by

SeongJae Park and committed by
Andrew Morton
62b7b1ff 16797a55

+53
+53
tools/testing/selftests/damon/sysfs.py
··· 199 199 200 200 assert_ctxs_committed(kdamonds.kdamonds[0].contexts, status['contexts']) 201 201 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 + 202 255 kdamonds.stop() 203 256 204 257 if __name__ == '__main__':