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

Configure Feed

Select the types of activity you want to include in your feed.

sysfs.py: extend assert_ctx_committed() for monitoring targets

assert_ctx_committed() is not asserting monitoring targets commitment,
since all existing callers of the function assume no target changes.
Extend it for future usage.

Link: https://lkml.kernel.org/r/20251023012535.69625-9-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Bijan Tabatabai <bijan311@gmail.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
65a9033d a00f18ab

+11
+11
tools/testing/selftests/damon/sysfs.py
··· 164 164 assert_true(dump['max_nr_regions'] == attrs.max_nr_regions, 165 165 'max_nr_regions', dump) 166 166 167 + def assert_monitoring_target_committed(target, dump): 168 + # target.pid is the pid "number", while dump['pid'] is 'struct pid' 169 + # pointer, and hence cannot be compared. 170 + assert_true(dump['obsolete'] == target.obsolete, 'target obsolete', dump) 171 + 172 + def assert_monitoring_targets_committed(targets, dump): 173 + assert_true(len(targets) == len(dump), 'len_targets', dump) 174 + for idx, target in enumerate(targets): 175 + assert_monitoring_target_committed(target, dump[idx]) 176 + 167 177 def assert_ctx_committed(ctx, dump): 168 178 ops_val = { 169 179 'vaddr': 0, ··· 182 172 } 183 173 assert_true(dump['ops']['id'] == ops_val[ctx.ops], 'ops_id', dump) 184 174 assert_monitoring_attrs_committed(ctx.monitoring_attrs, dump['attrs']) 175 + assert_monitoring_targets_committed(ctx.targets, dump['adaptive_targets']) 185 176 assert_schemes_committed(ctx.schemes, dump['schemes']) 186 177 187 178 def assert_ctxs_committed(ctxs, dump):