Skip to content

Commit dc6ce4b

Browse files
JackieLiu1axboe
authored andcommitted
io_uring: adjust smp_rmb inside io_cqring_events
Whenever smp_rmb is required to use io_cqring_events, keep smp_rmb inside the function io_cqring_events. Signed-off-by: Jackie Liu <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 2bbcd6d commit dc6ce4b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/io_uring.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,6 +2167,8 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit)
21672167

21682168
static unsigned io_cqring_events(struct io_cq_ring *ring)
21692169
{
2170+
/* See comment at the top of this file */
2171+
smp_rmb();
21702172
return READ_ONCE(ring->r.tail) - READ_ONCE(ring->r.head);
21712173
}
21722174

@@ -2182,8 +2184,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
21822184
DEFINE_WAIT(wait);
21832185
int ret;
21842186

2185-
/* See comment at the top of this file */
2186-
smp_rmb();
21872187
if (io_cqring_events(ring) >= min_events)
21882188
return 0;
21892189

@@ -2205,8 +2205,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
22052205
prepare_to_wait(&ctx->wait, &wait, TASK_INTERRUPTIBLE);
22062206

22072207
ret = 0;
2208-
/* See comment at the top of this file */
2209-
smp_rmb();
22102208
if (io_cqring_events(ring) >= min_events)
22112209
break;
22122210

0 commit comments

Comments
 (0)