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

selftests/damon/damos_quota: make real expectation of quota exceeds

Patch series "selftests/damon: three fixes for false results".

Fix three DAMON selftest bugs that cause two and one false positive
failures and successes.


This patch (of 3):

damos_quota.py assumes the quota will always exceeded. But whether quota
will be exceeded or not depend on the monitoring results. Actually the
monitored workload has chaning access pattern and hence sometimes the
quota may not really be exceeded. As a result, false positive test
failures happen. Expect how much time the quota will be exceeded by
checking the monitoring results, and use it instead of the naive
assumption.

Link: https://lkml.kernel.org/r/20250225222333.505646-1-sj@kernel.org
Link: https://lkml.kernel.org/r/20250225222333.505646-2-sj@kernel.org
Fixes: 51f58c9da14b ("selftests/damon: add a test for DAMOS quota")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
1c684d77 c29564d8

+6 -3
+6 -3
tools/testing/selftests/damon/damos_quota.py
··· 51 51 nr_quota_exceeds = scheme.stats.qt_exceeds 52 52 53 53 wss_collected.sort() 54 + nr_expected_quota_exceeds = 0 54 55 for wss in wss_collected: 55 56 if wss > sz_quota: 56 57 print('quota is not kept: %s > %s' % (wss, sz_quota)) 57 58 print('collected samples are as below') 58 59 print('\n'.join(['%d' % wss for wss in wss_collected])) 59 60 exit(1) 61 + if wss == sz_quota: 62 + nr_expected_quota_exceeds += 1 60 63 61 - if nr_quota_exceeds < len(wss_collected): 62 - print('quota is not always exceeded: %d > %d' % 63 - (len(wss_collected), nr_quota_exceeds)) 64 + if nr_quota_exceeds < nr_expected_quota_exceeds: 65 + print('quota is exceeded less than expected: %d < %d' % 66 + (nr_quota_exceeds, nr_expected_quota_exceeds)) 64 67 exit(1) 65 68 66 69 if __name__ == '__main__':