diff mbox series

[4/6] io_uring: move io_kiocb->nr_tw into comp_list union

Message ID 20240206162402.643507-5-axboe@kernel.dk (mailing list archive)
State New
Headers show
Series Misc cleanups / optimizations | expand

Commit Message

Jens Axboe Feb. 6, 2024, 4:22 p.m. UTC
comp_list is only used for completion purposes, which it why it
currently shares space with apoll_events (which is only used for poll
triggering). nr_rw is also not used with comp_list, the former is just
used for local task_list wakeup optimizations.

This doesn't save any space in io_kiocb, rather it now leaves a 32-bit
hole that can be used for something else, when the need arises.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 include/linux/io_uring_types.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h
index 69a043ff8460..8c0742f5b57e 100644
--- a/include/linux/io_uring_types.h
+++ b/include/linux/io_uring_types.h
@@ -602,8 +602,6 @@  struct io_kiocb {
 	 */
 	u16				buf_index;
 
-	atomic_t			refs;
-
 	io_req_flags_t			flags;
 
 	struct io_ring_ctx		*ctx;
@@ -629,8 +627,11 @@  struct io_kiocb {
 	union {
 		/* used by request caches, completion batching and iopoll */
 		struct io_wq_work_node	comp_list;
-		/* cache ->apoll->events */
-		__poll_t apoll_events;
+		struct {
+			/* cache ->apoll->events */
+			__poll_t apoll_events;
+			unsigned nr_tw;
+		};
 	};
 
 	struct io_rsrc_node		*rsrc_node;
@@ -639,7 +640,7 @@  struct io_kiocb {
 
 	struct io_task_work		io_task_work;
 	atomic_t			poll_refs;
-	unsigned			nr_tw;
+	atomic_t			refs;
 	/* internal polling, see IORING_FEAT_FAST_POLL */
 	struct async_poll		*apoll;
 	/* opcode allocated if it needs to store data for async defer */