<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 9, 2019 at 10:43 PM Jan Stancek <<a href="mailto:jstancek@redhat.com">jstancek@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">read_all is currently retrying only for short time period and it's<br>
retrying to queue for same worker. If that worker is busy, it easily<br>
hits timeout.<br>
<br>
For example 'kernel_page_tables' on aarch64 can take long time to open/read:<br>
# time dd if=/sys/kernel/debug/kernel_page_tables of=/dev/null count=1 bs=1024<br>
1+0 records in<br>
1+0 records out<br>
1024 bytes (1.0 kB, 1.0 KiB) copied, 13.0531 s, 0.1 kB/s<br>
<br>
real 0m13.066s<br>
user 0m0.000s<br>
sys 0m13.059s<br>
<br>
Rather than retrying to queue for specific worker, pick any that can accept<br>
the work and keep trying until we succeed or hit test timeout.<br>
<br>
Signed-off-by: Jan Stancek <<a href="mailto:jstancek@redhat.com" target="_blank">jstancek@redhat.com</a>><br>
---<br>
testcases/kernel/fs/read_all/read_all.c | 33 +++++++++++++++++++++++++++++++--<br>
1 file changed, 31 insertions(+), 2 deletions(-)<br>
<br>
v2: Increase sleep gradually.<br>
<br>
diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c<br>
index 3dac20e02638..7beb08ccf712 100644<br>
--- a/testcases/kernel/fs/read_all/read_all.c<br>
+++ b/testcases/kernel/fs/read_all/read_all.c<br>
@@ -282,6 +282,35 @@ static void spawn_workers(void)<br>
}<br>
}<br>
<br>
+static void work_push_retry(int worker, const char *buf)<br>
+{<br>
+ int i, ret, worker_min, worker_max, usleep_time = 100;<br>
+<br>
+ if (worker < 0) {<br>
+ /* pick any, try -worker first */<br>
+ worker_min = worker * (-1);<br>
+ worker_max = worker_count;<br>
+ } else {<br>
+ /* keep trying worker */<br>
+ worker_min = worker;<br>
+ worker_max = worker + 1;<br>
+ }<br>
+ i = worker_min;<br>
+<br>
+ for (;;) {<br>
+ ret = queue_push(workers[i].q, buf);<br>
+ if (ret == 1)<br>
+ break;<br>
+<br>
+ if (++i >= worker_max) {<br>
+ i = worker_min;<br>
+ if (usleep_time < 100000)<br>
+ usleep_time *= 2;<br>
+ usleep(usleep_time);<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">At first, I thought of TST_RETRY_FN_EXP_BACKOFF, but it seems not easy to find the proper value of MAX_DELAY, so you method looks more stable to read_all.</div><br></div><div><div class="gmail_default" style="font-size:small"> Acked-by: Li Wang <<a href="mailto:liwang@redhat.com">liwang@redhat.com</a>></div></div><div> </div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>