On Aug 8, 2021, at 9:07 PM, Hao Xu [off-list ref] wrote:
在 2021/8/9 上午1:31, Nadav Amit 写道:
quoted
quoted
On Aug 8, 2021, at 5:55 AM, Pavel Begunkov [off-list ref] wrote:
On 8/8/21 1:13 AM, Nadav Amit wrote:
quoted
From: Nadav Amit <redacted>
When using SQPOLL, the submission queue polling thread calls
task_work_run() to run queued work. However, when work is added with
TWA_SIGNAL - as done by io_uring itself - the TIF_NOTIFY_SIGNAL remains
static int io_req_task_work_add(struct io_kiocb *req)
{
...
notify = (req->ctx->flags & IORING_SETUP_SQPOLL) ? TWA_NONE : TWA_SIGNAL;
if (!task_work_add(tsk, &tctx->task_work, notify))
...
}
io_uring doesn't set TIF_NOTIFY_SIGNAL for SQPOLL. But if you see it, I'm
rather curious who does.
I was saying io-uring, but I meant io-uring in the wider sense:
io_queue_worker_create().
Here is a call trace for when TWA_SIGNAL is used. io_queue_worker_create()
uses TWA_SIGNAL. It is called by io_wqe_dec_running(), and not shown due
to inlining:
Hi Nadav, Pavel,
How about trying to make this kind of call to use TWA_NONE for sqthread,
though I know for this case currently there is no info to get to know if
task is sqthread. I think we shouldn't kick sqthread.
It is possible, but it would break the abstractions and propagating
it would be disgusting. Let me give it some thought.
Regardless, I think that this patch should go to 5.14 and stable,
and any solution to avoid kicking the SQ should come on top (to be
safe).