On 2/20/21 1:11 AM, Hao Xu wrote: >> @@ -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? -- Jens Axboe