From: Jens Axboe <axboe@kernel.dk>
To: Uday Shankar <ushankar@purestorage.com>,
Pavel Begunkov <asml.silence@gmail.com>
Cc: io-uring@vger.kernel.org
Subject: Re: [PATCH] io-wq: backoff when retrying worker creation
Date: Fri, 7 Feb 2025 11:24:27 -0700 [thread overview]
Message-ID: <7a2864fa-3312-413a-b513-58671ce3963f@kernel.dk> (raw)
In-Reply-To: <20250206-wq_retry-v1-1-6d79bde1e69f@purestorage.com>
On 2/6/25 3:38 PM, Uday Shankar wrote:
> io_uring/io-wq.c | 23 ++++++++++++++++++-----
> 1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c
> index f7d328feb7225d809601707e423c86a85ebb1c3c..173c77b70060bbbb2cd6009614c079095fab3e3c 100644
> --- a/io_uring/io-wq.c
> +++ b/io_uring/io-wq.c
> @@ -63,7 +63,7 @@ struct io_worker {
>
> union {
> struct rcu_head rcu;
> - struct work_struct work;
> + struct delayed_work work;
> };
> };
>
> @@ -784,6 +784,18 @@ static inline bool io_should_retry_thread(struct io_worker *worker, long err)
> }
> }
>
> +static void queue_create_worker_retry(struct io_worker *worker)
> +{
> + /*
> + * We only bother retrying because there's a chance that the
> + * failure to create a worker is due to some temporary condition
> + * in the forking task (e.g. outstanding signal); give the task
> + * some time to clear that condition.
> + */
> + schedule_delayed_work(
> + &worker->work, msecs_to_jiffies(worker->init_retries * 5));
> +}
This should be broken ala:
schedule_delayed_work(&worker->work,
msecs_to_jiffies(worker->init_retries * 5));
as that's more readable. But that's just a minor nit. I do think the
increased backoff makes sense, and while I agree that this isn't the
prettiest solution (or guaranteed foolproof), it'll most likely fix the
issue.
> static void io_workqueue_create(struct work_struct *work)
> {
> - struct io_worker *worker = container_of(work, struct io_worker, work);
> + struct io_worker *worker = container_of(
> + work, struct io_worker, work.work);
Same here on line break.
I can make these edits while applying, or just send a v2. Thanks!
--
Jens Axboe
prev parent reply other threads:[~2025-02-07 18:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 22:38 [PATCH] io-wq: backoff when retrying worker creation Uday Shankar
2025-02-07 2:20 ` lizetao
2025-02-07 18:24 ` Jens Axboe [this message]
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=7a2864fa-3312-413a-b513-58671ce3963f@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=io-uring@vger.kernel.org \
--cc=ushankar@purestorage.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 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.