Skip to contentSkip to conversation

io_uring: kill io_llist_xchg

PATCH Applied Pavel Begunkov 2 participants 2 messages Oct 18, 2024 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: kill io_llist_xchg

io_llist_xchg is only used to set the list to NULL, which can also be done with llist_del_all(). Use the latter and kill io_llist_xchg.

---
 io_uring/io_uring.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
io_uring/io_uring.c +1 -15
index b2736e3491b8..ed34f356d703 100644
@@ -1076,20 +1076,6 @@ struct llist_node *io_handle_tw_list(struct llist_node *node,
 	return node;
 }
 
-/**
- * io_llist_xchg - swap all entries in a lock-less list
- * @head:	the head of lock-less list to delete all entries
- * @new:	new entry as the head of the list
- *
- * If list is empty, return NULL, otherwise, return the pointer to the first entry.
- * The order of entries returned is from the newest to the oldest added one.
- */
-static inline struct llist_node *io_llist_xchg(struct llist_head *head,
-					       struct llist_node *new)
-{
-	return xchg(&head->first, new);
-}
-
 static __cold void io_fallback_tw(struct io_uring_task *tctx, bool sync)
 {
 	struct llist_node *node = llist_del_all(&tctx->task_list);
@@ -1311,7 +1297,7 @@ static int __io_run_local_work(struct io_ring_ctx *ctx, struct io_tw_state *ts,
 	 * llists are in reverse order, flip it back the right way before
 	 * running the pending items.
 	 */
-	node = llist_reverse_order(io_llist_xchg(&ctx->work_llist, NULL));
+	node = llist_reverse_order(llist_del_all(&ctx->work_llist));
 	while (node) {
 		struct llist_node *next = node->next;
 		struct io_kiocb *req = container_of(node, struct io_kiocb,
Signature · 1 line
2.46.0
maintainer Applied
#1 lore raw
Quoted 4 lines · Pavel Begunkov

io_llist_xchg is only used to set the list to NULL, which can also be done with llist_del_all(). Use the latter and kill io_llist_xchg.

Applied, thanks!

[1/1] io_uring: kill io_llist_xchg

      commit: cb943835067450aebf6f1171e81ea5958ce34b03

Best regards,

Signature · 1 line
Jens Axboe