Thread (49 messages) 49 messages, 6 authors, 2021-03-05

Re: [PATCH 05/18] io_uring: tie async worker side to the task context

From: Hao Xu <hidden>
Date: 2021-02-21 09:17:51

在 2021/2/20 下午10:38, Jens Axboe 写道:
On 2/20/21 1:11 AM, Hao Xu wrote:
quoted
quoted
@@ -8167,6 +8153,14 @@ static int io_uring_alloc_task_context(struct task_struct *task)
   		return ret;
   	}
   
+	tctx->io_wq = io_init_wq_offload(ctx);
+	if (IS_ERR(tctx->io_wq)) {
+		ret = PTR_ERR(tctx->io_wq);
+		percpu_counter_destroy(&tctx->inflight);
+		kfree(tctx);
+		return ret;
+	}
+
How about putting this before initing tctx->inflight so that
we don't need to destroy tctx->inflight in the error path?
Sure, but then we'd need to destroy the workqueue in the error path if
percpu_counter_init() fails instead.

Can you elaborate on why you think that'd be an improvement to the error
path?
You're right. I didn't realize it..
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help