Skip to content

Commit 7cae596

Browse files
Dylan Yudakenaxboe
authored andcommitted
io_uring: register single issuer task at creation
Instead of picking the task from the first submitter task, rather use the creator task or in the case of disabled (IORING_SETUP_R_DISABLED) the enabling task. This approach allows a lot of simplification of the logic here. This removes init logic from the submission path, which can always be a bit confusing, but also removes the need for locking to write (or read) the submitter_task. Users that want to move a ring before submitting can create the ring disabled and then enable it on the submitting task. Signed-off-by: Dylan Yudaken <[email protected]> Fixes: 97bbdc0 ("io_uring: add IORING_SETUP_SINGLE_ISSUER") Signed-off-by: Jens Axboe <[email protected]>
1 parent e775f93 commit 7cae596

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

io_uring/io_uring.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3357,6 +3357,10 @@ static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
33573357
goto err;
33583358
}
33593359

3360+
if (ctx->flags & IORING_SETUP_SINGLE_ISSUER
3361+
&& !(ctx->flags & IORING_SETUP_R_DISABLED))
3362+
ctx->submitter_task = get_task_struct(current);
3363+
33603364
file = io_uring_get_file(ctx);
33613365
if (IS_ERR(file)) {
33623366
ret = PTR_ERR(file);
@@ -3548,6 +3552,9 @@ static int io_register_enable_rings(struct io_ring_ctx *ctx)
35483552
if (!(ctx->flags & IORING_SETUP_R_DISABLED))
35493553
return -EBADFD;
35503554

3555+
if (ctx->flags & IORING_SETUP_SINGLE_ISSUER && !ctx->submitter_task)
3556+
ctx->submitter_task = get_task_struct(current);
3557+
35513558
if (ctx->restrictions.registered)
35523559
ctx->restricted = 1;
35533560

0 commit comments

Comments
 (0)