Skip to content

Commit 644c4a7

Browse files
isilenceaxboe
authored andcommitted
io_uring: move iopoll ctx fields around
Move poll_multi_queue and iopoll_list to the submission cache line, it doesn't make much sense to keep them separately, and is better place for it in general. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/5b03cf7e6652e350e6e70a917eec72ba9f33b97b.1692916914.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 0aa7aa5 commit 644c4a7

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

include/linux/io_uring_types.h

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,15 @@ struct io_ring_ctx {
256256
struct io_hash_table cancel_table_locked;
257257
struct io_alloc_cache apoll_cache;
258258
struct io_alloc_cache netmsg_cache;
259+
260+
/*
261+
* ->iopoll_list is protected by the ctx->uring_lock for
262+
* io_uring instances that don't use IORING_SETUP_SQPOLL.
263+
* For SQPOLL, only the single threaded io_sq_thread() will
264+
* manipulate the list, hence no extra locking is needed there.
265+
*/
266+
struct io_wq_work_list iopoll_list;
267+
bool poll_multi_queue;
259268
} ____cacheline_aligned_in_smp;
260269

261270
struct {
@@ -284,20 +293,6 @@ struct io_ring_ctx {
284293
struct wait_queue_head cq_wait;
285294
} ____cacheline_aligned_in_smp;
286295

287-
struct {
288-
spinlock_t completion_lock;
289-
290-
bool poll_multi_queue;
291-
292-
/*
293-
* ->iopoll_list is protected by the ctx->uring_lock for
294-
* io_uring instances that don't use IORING_SETUP_SQPOLL.
295-
* For SQPOLL, only the single threaded io_sq_thread() will
296-
* manipulate the list, hence no extra locking is needed there.
297-
*/
298-
struct io_wq_work_list iopoll_list;
299-
} ____cacheline_aligned_in_smp;
300-
301296
/* timeouts */
302297
struct {
303298
spinlock_t timeout_lock;
@@ -308,6 +303,8 @@ struct io_ring_ctx {
308303

309304
struct io_uring_cqe completion_cqes[16];
310305

306+
spinlock_t completion_lock;
307+
311308
/* IRQ completion list, under ->completion_lock */
312309
struct io_wq_work_list locked_free_list;
313310
unsigned int locked_free_nr;

0 commit comments

Comments
 (0)