summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2023-04-06 14:20:11 +0100
committerJens Axboe <axboe@kernel.dk>2023-04-06 16:23:28 -0600
commit5150940079a3ce94d7474f6f5b0d6276569dc1de (patch)
tree9f5fdfd34494e5be021c6b8ed9db79095e99c364 /io_uring
parent8501fe70ae9855076ffb03a3670e02a7b3437304 (diff)
downloadlinux-5150940079a3ce94d7474f6f5b0d6276569dc1de.tar.gz
io_uring: inline llist_add()
We'll need to grab some information from the previous request in the tw list, inline llist_add(), it'll be used in the following patch. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/f0165493af7b379943c792114b972f331e7d7d10.1680782017.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/io_uring.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 6f175fe682e4..786ecfa01c54 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1303,8 +1303,15 @@ static __cold void io_fallback_tw(struct io_uring_task *tctx)
static void io_req_local_work_add(struct io_kiocb *req)
{
struct io_ring_ctx *ctx = req->ctx;
+ struct llist_node *first;
- if (!llist_add(&req->io_task_work.node, &ctx->work_llist))
+ first = READ_ONCE(ctx->work_llist.first);
+ do {
+ req->io_task_work.node.next = first;
+ } while (!try_cmpxchg(&ctx->work_llist.first, &first,
+ &req->io_task_work.node));
+
+ if (first)
return;
/* needed for the following wake up */