summaryrefslogtreecommitdiffstats
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-06-17 18:14:08 +0100
committerJens Axboe <axboe@kernel.dk>2021-06-18 09:22:02 -0600
commitc6538be9e4883d1371adaff45712b1b2172773dd (patch)
tree0732aa5ff3731634d10a9be55998ffe202c2e291 /fs/io_uring.c
parentebd0df2e63426bbd9ed50966e888c87eac88fc30 (diff)
downloadlinux-c6538be9e4883d1371adaff45712b1b2172773dd.tar.bz2
io_uring: refactor tctx task_work list splicing
We don't need a full copy of tctx->task_list in tctx_task_work(), but only a first one, so just assign node directly. Taking into account that task_works are run in a context of a task, it's very unlikely to first see non-empty tctx->task_list and then splice it empty, can only happen with task_work cancellations that is not-normal slow path anyway. Hence, get rid of the check in the end, it's there not for validity but "performance" purposes. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/d076c83fedb8253baf43acb23b8fafd7c5da1714.1623949695.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 49f06484ba0e..51db0d80b67b 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1897,15 +1897,13 @@ static void tctx_task_work(struct callback_head *cb)
clear_bit(0, &tctx->task_state);
while (!wq_list_empty(&tctx->task_list)) {
- struct io_wq_work_list list;
struct io_wq_work_node *node;
spin_lock_irq(&tctx->task_lock);
- list = tctx->task_list;
+ node = tctx->task_list.first;
INIT_WQ_LIST(&tctx->task_list);
spin_unlock_irq(&tctx->task_lock);
- node = list.first;
while (node) {
struct io_wq_work_node *next = node->next;
struct io_kiocb *req = container_of(node, struct io_kiocb,
@@ -1919,9 +1917,6 @@ static void tctx_task_work(struct callback_head *cb)
req->task_work.func(&req->task_work);
node = next;
}
-
- if (!list.first)
- break;
cond_resched();
}