* [PATCH] io_uring: kill tw-related outdated comments
@ 2022-11-17 18:47 Pavel Begunkov
2022-11-17 19:45 ` Gabriel Krisman Bertazi
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2022-11-17 18:47 UTC (permalink / raw)
To: io-uring; +Cc: Jens Axboe, asml.silence
task_work fallback is executed from a workqueue, so current and
req->task are not necessarily the same. It's still safe to poke into it
as the request holds a task_struct reference.
Signed-off-by: Pavel Begunkov <[email protected]>
---
io_uring/io_uring.c | 2 +-
io_uring/poll.c | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 94329c1ce91d..5a8a43fb6750 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1249,7 +1249,7 @@ static void io_req_task_cancel(struct io_kiocb *req, bool *locked)
void io_req_task_submit(struct io_kiocb *req, bool *locked)
{
io_tw_lock(req->ctx, locked);
- /* req->task == current here, checking PF_EXITING is safe */
+
if (likely(!(req->task->flags & PF_EXITING)))
io_queue_sqe(req);
else
diff --git a/io_uring/poll.c b/io_uring/poll.c
index 2830b7daf952..5d4a0a4a379a 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -214,7 +214,6 @@ static int io_poll_check_events(struct io_kiocb *req, bool *locked)
struct io_ring_ctx *ctx = req->ctx;
int v, ret;
- /* req->task == current here, checking PF_EXITING is safe */
if (unlikely(req->task->flags & PF_EXITING))
return -ECANCELED;
--
2.38.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] io_uring: kill tw-related outdated comments
2022-11-17 18:47 [PATCH] io_uring: kill tw-related outdated comments Pavel Begunkov
@ 2022-11-17 19:45 ` Gabriel Krisman Bertazi
0 siblings, 0 replies; 2+ messages in thread
From: Gabriel Krisman Bertazi @ 2022-11-17 19:45 UTC (permalink / raw)
To: Pavel Begunkov; +Cc: io-uring, Jens Axboe
Pavel Begunkov <[email protected]> writes:
> task_work fallback is executed from a workqueue, so current and
> req->task are not necessarily the same. It's still safe to poke into it
> as the request holds a task_struct reference.
Makes sense to me. Feel free to add
Reviewed-by: Gabriel Krisman Bertazi <[email protected]>
>
> Signed-off-by: Pavel Begunkov <[email protected]>
> ---
> io_uring/io_uring.c | 2 +-
> io_uring/poll.c | 1 -
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index 94329c1ce91d..5a8a43fb6750 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -1249,7 +1249,7 @@ static void io_req_task_cancel(struct io_kiocb *req, bool *locked)
> void io_req_task_submit(struct io_kiocb *req, bool *locked)
> {
> io_tw_lock(req->ctx, locked);
> - /* req->task == current here, checking PF_EXITING is safe */
> +
> if (likely(!(req->task->flags & PF_EXITING)))
> io_queue_sqe(req);
> else
> diff --git a/io_uring/poll.c b/io_uring/poll.c
> index 2830b7daf952..5d4a0a4a379a 100644
> --- a/io_uring/poll.c
> +++ b/io_uring/poll.c
> @@ -214,7 +214,6 @@ static int io_poll_check_events(struct io_kiocb *req, bool *locked)
> struct io_ring_ctx *ctx = req->ctx;
> int v, ret;
>
> - /* req->task == current here, checking PF_EXITING is safe */
> if (unlikely(req->task->flags & PF_EXITING))
> return -ECANCELED;
--
Gabriel Krisman Bertazi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-17 19:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-17 18:47 [PATCH] io_uring: kill tw-related outdated comments Pavel Begunkov
2022-11-17 19:45 ` Gabriel Krisman Bertazi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox