Skip to content

Commit ac8691c

Browse files
committed
io_uring: always plug for any number of IOs
Currently we only plug if we're doing more than two request. We're going to be relying on always having the plug there to pass down information, so plug unconditionally. Signed-off-by: Jens Axboe <[email protected]>
1 parent 5a473e8 commit ac8691c

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

fs/io_uring.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,6 @@ struct io_kiocb {
676676
};
677677
};
678678

679-
#define IO_PLUG_THRESHOLD 2
680679
#define IO_IOPOLL_BATCH 8
681680

682681
struct io_submit_state {
@@ -5914,7 +5913,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
59145913
static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr,
59155914
struct file *ring_file, int ring_fd)
59165915
{
5917-
struct io_submit_state state, *statep = NULL;
5916+
struct io_submit_state state;
59185917
struct io_kiocb *link = NULL;
59195918
int i, submitted = 0;
59205919

@@ -5931,10 +5930,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr,
59315930
if (!percpu_ref_tryget_many(&ctx->refs, nr))
59325931
return -EAGAIN;
59335932

5934-
if (nr > IO_PLUG_THRESHOLD) {
5935-
io_submit_state_start(&state, nr);
5936-
statep = &state;
5937-
}
5933+
io_submit_state_start(&state, nr);
59385934

59395935
ctx->ring_fd = ring_fd;
59405936
ctx->ring_file = ring_file;
@@ -5949,14 +5945,14 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr,
59495945
io_consume_sqe(ctx);
59505946
break;
59515947
}
5952-
req = io_alloc_req(ctx, statep);
5948+
req = io_alloc_req(ctx, &state);
59535949
if (unlikely(!req)) {
59545950
if (!submitted)
59555951
submitted = -EAGAIN;
59565952
break;
59575953
}
59585954

5959-
err = io_init_req(ctx, req, sqe, statep);
5955+
err = io_init_req(ctx, req, sqe, &state);
59605956
io_consume_sqe(ctx);
59615957
/* will complete beyond this point, count as submitted */
59625958
submitted++;
@@ -5982,8 +5978,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr,
59825978
}
59835979
if (link)
59845980
io_queue_link_head(link);
5985-
if (statep)
5986-
io_submit_state_end(&state);
5981+
io_submit_state_end(&state);
59875982

59885983
/* Commit SQ ring head once we've consumed and submitted all SQEs */
59895984
io_commit_sqring(ctx);

0 commit comments

Comments
 (0)