From: Pavel Begunkov <[email protected]>
To: Nadav Amit <[email protected]>
Cc: Jens Axboe <[email protected]>,
"[email protected]" <[email protected]>,
"[email protected]" <[email protected]>
Subject: Re: [PATCH 1/2] io_uring: clear TIF_NOTIFY_SIGNAL when running task work
Date: Mon, 9 Aug 2021 11:18:56 +0100 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 8/8/21 6:31 PM, Nadav Amit wrote:
>> On Aug 8, 2021, at 5:55 AM, Pavel Begunkov <[email protected]> wrote:
>> On 8/8/21 1:13 AM, Nadav Amit wrote:
>>> From: Nadav Amit <[email protected]>
>>>
>>> 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:
>
> [ 70.540761] Call Trace:
> [ 70.541352] dump_stack+0x7d/0x9c
> [ 70.541930] task_work_add.cold+0x9/0x12
> [ 70.542591] io_wqe_dec_running+0xd6/0xf0
> [ 70.543259] io_wq_worker_sleeping+0x3d/0x60
> [ 70.544106] schedule+0xa0/0xc0
> [ 70.544673] userfaultfd_read_iter+0x2c3/0x790
> [ 70.545374] ? wake_up_q+0xa0/0xa0
> [ 70.545887] io_iter_do_read+0x1e/0x40
> [ 70.546531] io_read+0xdc/0x340
> [ 70.547148] ? update_curr+0x72/0x1c0
> [ 70.547887] ? update_load_avg+0x7c/0x600
> [ 70.548538] ? __switch_to_xtra+0x10a/0x500
> [ 70.549264] io_issue_sqe+0xd99/0x1840
> [ 70.549887] ? lock_timer_base+0x72/0xa0
> [ 70.550516] ? try_to_del_timer_sync+0x54/0x80
> [ 70.551224] io_wq_submit_work+0x87/0xb0
> [ 70.552001] io_worker_handle_work+0x2b5/0x4b0
> [ 70.552705] io_wqe_worker+0xd6/0x2f0
> [ 70.553364] ? recalc_sigpending+0x1c/0x50
> [ 70.554074] ? io_worker_handle_work+0x4b0/0x4b0
> [ 70.554813] ret_from_fork+0x22/0x30
>
> Does it answer your question?
Pretty much, thanks
--
Pavel Begunkov
next prev parent reply other threads:[~2021-08-09 10:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-08 0:13 [PATCH 0/2] io_uring: bug fixes Nadav Amit
2021-08-08 0:13 ` [PATCH 1/2] io_uring: clear TIF_NOTIFY_SIGNAL when running task work Nadav Amit
2021-08-08 12:55 ` Pavel Begunkov
2021-08-08 17:31 ` Nadav Amit
2021-08-09 4:07 ` Hao Xu
2021-08-09 4:50 ` Nadav Amit
2021-08-09 10:35 ` Pavel Begunkov
2021-08-09 10:18 ` Pavel Begunkov [this message]
2021-08-09 21:48 ` Olivier Langlois
2021-08-10 8:28 ` Nadav Amit
2021-08-10 13:33 ` Olivier Langlois
2021-08-10 21:32 ` Pavel Begunkov
2021-08-11 2:33 ` Nadav Amit
2021-08-11 2:51 ` Jens Axboe
2021-08-11 5:40 ` I/O cancellation in io-uring (was: io_uring: clear TIF_NOTIFY_SIGNAL ...) Nadav Amit
2021-08-08 0:13 ` [PATCH 2/2] io_uring: Use WRITE_ONCE() when writing to sq_flags Nadav Amit
2021-08-09 13:53 ` [PATCH 0/2] io_uring: bug fixes Jens Axboe
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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox