From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Subject: [Devel] [PATCH vz10] selftests/damon: wait for the merge to apply the new max_nr_regions
Date: Fri, 21 Aug 2026 18:13:24 +0300 [thread overview]
Message-ID: <20260821151326.794546-1-eva.kurchatova@virtuozzo.com> (raw)
damon_nr_regions sleeps 0.3s after committing max_nr_regions and then
reads the number of regions back, which assumes the merge has happened
by then. On a machine that is not idle it has not, and the test fails
on a region count that is still the old one.
Poll until the count settles instead of sleeping for a fixed time.
https://virtuozzo.atlassian.net/browse/VSTOR-132453
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
.../selftests/damon/damon_nr_regions.py | 35 +++++++++++--------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/tools/testing/selftests/damon/damon_nr_regions.py b/tools/testing/selftests/damon/damon_nr_regions.py
index cb31cd140d22..39063ce5b27d 100755
--- a/tools/testing/selftests/damon/damon_nr_regions.py
+++ b/tools/testing/selftests/damon/damon_nr_regions.py
@@ -4,6 +4,7 @@
import subprocess
import time
+
import _damon_sysfs
def test_nr_regions(real_nr_regions, min_nr_regions, max_nr_regions):
@@ -114,27 +115,31 @@ def main():
proc.terminate()
print('commit failed: %s' % err)
exit(1)
- # wait for next merge operation is executed
- time.sleep(0.3)
+ # wait for the merge operations to apply the new max_nr_regions
+ nr_tried_regions = 0
+ for _ in range(50):
+ time.sleep(0.1)
- err = kdamonds.kdamonds[0].update_schemes_tried_regions()
- if err is not None:
- proc.terminate()
- print('tried regions update failed: %s' % err)
- exit(1)
+ err = kdamonds.kdamonds[0].update_schemes_tried_regions()
+ if err is not None:
+ proc.terminate()
+ print('tried regions update failed: %s' % err)
+ exit(1)
- scheme = kdamonds.kdamonds[0].contexts[0].schemes[0]
- if scheme.tried_regions is None:
- proc.terminate()
- print('tried regions is not collected')
- exit(1)
+ scheme = kdamonds.kdamonds[0].contexts[0].schemes[0]
+ if scheme.tried_regions is None:
+ proc.terminate()
+ print('tried regions is not collected')
+ exit(1)
+
+ nr_tried_regions = len(scheme.tried_regions)
+ if 0 < nr_tried_regions <= 7:
+ break
+ proc.terminate()
- nr_tried_regions = len(scheme.tried_regions)
if nr_tried_regions <= 0:
- proc.terminate()
print('tried regions is not created')
exit(1)
- proc.terminate()
if nr_tried_regions > 7:
print('fail online-tuned max_nr_regions: %d > 7' % nr_tried_regions)
--
2.55.0
next reply other threads:[~2026-08-21 15:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 15:13 Eva Kurchatova [this message]
2026-08-31 23:22 ` Eva Kurchatova (Virtuozzo)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260821151326.794546-1-eva.kurchatova@virtuozzo.com \
--to=eva.kurchatova@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox