aboutsummaryrefslogtreecommitdiff
path: root/io_uring/notif.c
diff options
context:
space:
mode:
authorGravatar Pavel Begunkov <asml.silence@gmail.com> 2023-04-06 14:20:12 +0100
committerGravatar Jens Axboe <axboe@kernel.dk> 2023-04-06 16:23:28 -0600
commit8751d15426a31baaf40f7570263c27c3e5d1dc44 (patch)
treece78034f5b032052374c63e97c403143511365a2 /io_uring/notif.c
parentio_uring: inline llist_add() (diff)
downloadlinux-8751d15426a31baaf40f7570263c27c3e5d1dc44.tar.gz
linux-8751d15426a31baaf40f7570263c27c3e5d1dc44.tar.bz2
linux-8751d15426a31baaf40f7570263c27c3e5d1dc44.zip
io_uring: reduce scheduling due to tw
Every task_work will try to wake the task to be executed, which causes excessive scheduling and additional overhead. For some tw it's justified, but others won't do much but post a single CQE. When a task waits for multiple cqes, every such task_work will wake it up. Instead, the task may give a hint about how many cqes it waits for, io_req_local_work_add() will compare against it and skip wake ups if #cqes + #tw is not enough to satisfy the waiting condition. Task_work that uses the optimisation should be simple enough and never post more than one CQE. It's also ignored for non DEFER_TASKRUN rings. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/d2b77e99d1e86624d8a69f7037d764b739dcd225.1680782017.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/notif.c')
-rw-r--r--io_uring/notif.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io_uring/notif.c b/io_uring/notif.c
index 172105eb347d..e1846a25dde1 100644
--- a/io_uring/notif.c
+++ b/io_uring/notif.c
@@ -31,7 +31,7 @@ static void io_tx_ubuf_callback(struct sk_buff *skb, struct ubuf_info *uarg,
struct io_kiocb *notif = cmd_to_io_kiocb(nd);
if (refcount_dec_and_test(&uarg->refcnt))
- io_req_task_work_add(notif);
+ __io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE);
}
static void io_tx_ubuf_callback_ext(struct sk_buff *skb, struct ubuf_info *uarg,