From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] read_all: retry to queue work for any worker
Date: Wed, 9 Oct 2019 15:56:56 +0200 [thread overview]
Message-ID: <20191009135656.GD7561@rei.lan> (raw)
In-Reply-To: <26d555b1d9deddb5a6f0a93a7c7d3b00e8abc1ff.1570616598.git.jstancek@redhat.com>
Hi!
> +static void work_push_retry(int worker, const char *buf)
> +{
> + int i, ret, worker_min, worker_max;
> +
> + if (worker < 0) {
> + /* pick any, try -worker first */
> + worker_min = worker * (-1);
> + worker_max = worker_count;
> + } else {
> + /* keep trying worker */
> + worker_min = worker;
> + worker_max = worker + 1;
> + }
> + i = worker_min;
> +
> + for (;;) {
> + ret = queue_push(workers[i].q, buf);
> + if (ret == 1)
> + break;
> +
> + if (++i >= worker_max) {
> + i = worker_min;
> + usleep(100000);
My only concern is that we sleep for too long here. Maybe we should
start with smaller sleep here and increase it after a while.
Or have you checked that the tests runs as fast as if we had smaller
sleep here?
> + }
> + }
> +}
> +
> static void stop_workers(void)
> {
> const char stop_code[1] = { '\0' };
> @@ -292,7 +319,7 @@ static void stop_workers(void)
>
> for (i = 0; i < worker_count; i++) {
> if (workers[i].q)
> - TST_RETRY_FUNC(queue_push(workers[i].q, stop_code), 1);
> + work_push_retry(i, stop_code);
> }
>
> for (i = 0; i < worker_count; i++) {
> @@ -310,7 +337,7 @@ static void rep_sched_work(const char *path, int rep)
> for (i = j = 0; i < rep; i++, j++) {
> if (j >= worker_count)
> j = 0;
> - TST_RETRY_FUNC(queue_push(workers[j].q, path), 1);
> + work_push_retry(-j, path);
> }
> }
>
> --
> 1.8.3.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2019-10-09 13:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-09 10:29 [LTP] [PATCH] read_all: retry to queue work for any worker Jan Stancek
2019-10-09 13:56 ` Cyril Hrubis [this message]
2019-10-09 14:29 ` Jan Stancek
2019-10-09 14:42 ` [LTP] [PATCH v2] " Jan Stancek
2019-10-09 15:26 ` Cyril Hrubis
2019-10-11 8:24 ` Li Wang
2019-10-12 5:58 ` Li Wang
2019-10-12 6:17 ` Jan Stancek
2019-10-12 6:35 ` Li Wang
2019-10-12 6:49 ` Jan Stancek
2019-10-12 7:28 ` Li Wang
2019-10-13 7:54 ` Jan Stancek
2019-10-14 6:31 ` Li Wang
2019-10-15 14:15 ` Jan Stancek
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=20191009135656.GD7561@rei.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.