Skip to content

Commit 03f8320

Browse files
sjp38akpm00
authored andcommitted
selftests/damon/_damon_sysfs: read tried regions directories in order
Kdamond.update_schemes_tried_regions() reads and stores tried regions information out of address order. It makes debugging a test failure difficult. Change the behavior to do the reading and writing in the address order. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: SeongJae Park <[email protected]> Cc: Brendan Higgins <[email protected]> Cc: David Gow <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 094fb14 commit 03f8320

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/testing/selftests/damon/_damon_sysfs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,16 @@ def update_schemes_tried_regions(self):
420420
tried_regions = []
421421
tried_regions_dir = os.path.join(
422422
scheme.sysfs_dir(), 'tried_regions')
423+
region_indices = []
423424
for filename in os.listdir(
424425
os.path.join(scheme.sysfs_dir(), 'tried_regions')):
425426
tried_region_dir = os.path.join(tried_regions_dir, filename)
426427
if not os.path.isdir(tried_region_dir):
427428
continue
429+
region_indices.append(int(filename))
430+
for region_idx in sorted(region_indices):
431+
tried_region_dir = os.path.join(tried_regions_dir,
432+
'%d' % region_idx)
428433
region_values = []
429434
for f in ['start', 'end', 'nr_accesses', 'age']:
430435
content, err = read_file(

0 commit comments

Comments
 (0)