Re: [PATCH] io-wq: backoff when retrying worker creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux