diff mbox series

io_uring: kill tw-related outdated comments

Message ID deb4db0984b07e026d08b7bd1886cfc120d67f17.1668710788.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series io_uring: kill tw-related outdated comments | expand

Commit Message

Pavel Begunkov Nov. 17, 2022, 6:47 p.m. UTC
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 <asml.silence@gmail.com>
---
 io_uring/io_uring.c | 2 +-
 io_uring/poll.c     | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

Comments

Gabriel Krisman Bertazi Nov. 17, 2022, 7:45 p.m. UTC | #1
Pavel Begunkov <asml.silence@gmail.com> 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 <krisman@suse.de>

>
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> ---
>  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;
diff mbox series

Patch

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;