io_uring: kill tw-related outdated comments
PATCH 1/1 io_uring: kill tw-related outdated comments
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(-)
io_uring/io_uring.c +1 -1
@@ -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
io_uring/poll.c +0 -1
@@ -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 ;
Signature · 1 line
2.38.1
Quoted 3 lines · Pavel Begunkov
task_workfallback is executed from a workqueue, so current andreq->taskare not necessarily the same. It's still safe to poke into it as the request holds atask_structreference.
Makes sense to me. Feel free to add
Reviewed-by Gabriel Krisman Bertazi <[email protected]>
Quoted 31 lines
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(-)io_uring/io_uring.c +1
-1@@ -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 io_uring/poll.c +0
-1@@ -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 ;
Signature · 1 line
Gabriel Krisman Bertazi