From: Hao Xu <[email protected]>
To: Jens Axboe <[email protected]>, io-uring <[email protected]>
Subject: Re: [PATCH] io_uring: remove PF_EXITING checking in io_poll_rewait()
Date: Fri, 20 Aug 2021 01:39:52 +0800 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
在 2021/8/20 上午1:36, Jens Axboe 写道:
> On 8/19/21 11:29 AM, Jens Axboe wrote:
>> On 8/19/21 11:26 AM, Hao Xu wrote:
>>> 在 2021/8/19 下午11:48, Jens Axboe 写道:
>>>> We have two checks of task->flags & PF_EXITING left:
>>>>
>>>> 1) In io_req_task_submit(), which is called in task_work and hence always
>>>> in the context of the original task. That means that
>>>> req->task == current, and hence checking ->flags is totally fine.
>>>>
>>>> 2) In io_poll_rewait(), where we need to stop re-arming poll to prevent
>>>> it interfering with cancelation. Here, req->task is not necessarily
>>>> current, and hence the check is racy. Use the ctx refs state instead
>>>> to check if we need to cancel this request or not.
>>> Hi Jens,
>>> I saw cases that io_req_task_submit() and io_poll_rewait() in one
>>> function, why one is safe and the other one not? btw, it seems both two
>>> executes in task_work context..and task_work_add() may fail and then
>>> work goes to system_wq, is that case safe?
>>
>> io_req_task_submit() is guaranteed to be run in the task that is req->task,
>> io_poll_rewait() is not. The latter can get called from eg the poll
>> waitqueue handling, which is not run from the task in question.
>
> Pavel nudged me, and in the 5.15 branch we actually only do run rewait
> from the task itself. So this patch isn't needed, we can ignore it!
> Might just augment it with a comment, like it was done for submit.
saw this after my second email. cool!
>
next prev parent reply other threads:[~2021-08-19 17:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-19 15:48 [PATCH] io_uring: remove PF_EXITING checking in io_poll_rewait() Jens Axboe
2021-08-19 17:26 ` Hao Xu
2021-08-19 17:29 ` Jens Axboe
2021-08-19 17:36 ` Jens Axboe
2021-08-19 17:39 ` Hao Xu [this message]
2021-08-19 17:36 ` Hao Xu
2021-08-19 17:37 ` 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 \
--in-reply-to=29134d4d-99a6-949d-0df7-7e8ddfef9a27@linux.alibaba.com \
[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