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

selftests/damon/drgn_dump_damon_status: dump damos->migrate_dests

drgn_dump_damon_status.py is a script for dumping DAMON internal status in
json format. It is being used for seeing if DAMON parameters that are set
using _damon_sysfs.py are actually passed to DAMON in the kernel space.
It is, however, not dumping full DAMON internal status, and it makes
increasing test coverage difficult. Add damos->migrate_dests dumping for
more tests.

Link: https://lkml.kernel.org/r/20250720171652.92309-10-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
c1a69589 80d4e381

+14
+14
tools/testing/selftests/damon/drgn_dump_damon_status.py
··· 117 117 ['high', int], ['mid', int], ['low', int], 118 118 ]) 119 119 120 + def damos_migrate_dests_to_dict(dests): 121 + nr_dests = int(dests.nr_dests) 122 + node_id_arr = [] 123 + weight_arr = [] 124 + for i in range(nr_dests): 125 + node_id_arr.append(int(dests.node_id_arr[i])) 126 + weight_arr.append(int(dests.weight_arr[i])) 127 + return { 128 + 'node_id_arr': node_id_arr, 129 + 'weight_arr': weight_arr, 130 + 'nr_dests': nr_dests, 131 + } 132 + 120 133 def scheme_to_dict(scheme): 121 134 return to_dict(scheme, [ 122 135 ['pattern', damos_access_pattern_to_dict], ··· 138 125 ['quota', damos_quota_to_dict], 139 126 ['wmarks', damos_watermarks_to_dict], 140 127 ['target_nid', int], 128 + ['migrate_dests', damos_migrate_dests_to_dict], 141 129 ]) 142 130 143 131 def schemes_to_list(schemes):