Skip to content

Commit 1c684d7

Browse files
sjp38akpm00
authored andcommitted
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: 51f58c9 ("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>
1 parent c29564d commit 1c684d7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/testing/selftests/damon/damos_quota.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,19 @@ def main():
5151
nr_quota_exceeds = scheme.stats.qt_exceeds
5252

5353
wss_collected.sort()
54+
nr_expected_quota_exceeds = 0
5455
for wss in wss_collected:
5556
if wss > sz_quota:
5657
print('quota is not kept: %s > %s' % (wss, sz_quota))
5758
print('collected samples are as below')
5859
print('\n'.join(['%d' % wss for wss in wss_collected]))
5960
exit(1)
61+
if wss == sz_quota:
62+
nr_expected_quota_exceeds += 1
6063

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))
6467
exit(1)
6568

6669
if __name__ == '__main__':

0 commit comments

Comments
 (0)