Commit fdb288a6 authored by Jackie Liu's avatar Jackie Liu Committed by Jens Axboe

io_uring: use wait_event_interruptible for cq_wait conditional wait

The previous patch has ensured that io_cqring_events contain
smp_rmb memory barriers, Now we can use wait_event_interruptible
to keep the code simple.
Signed-off-by: default avatarJackie Liu <liuyun01@kylinos.cn>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent dc6ce4bc
...@@ -2181,7 +2181,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, ...@@ -2181,7 +2181,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
{ {
struct io_cq_ring *ring = ctx->cq_ring; struct io_cq_ring *ring = ctx->cq_ring;
sigset_t ksigmask, sigsaved; sigset_t ksigmask, sigsaved;
DEFINE_WAIT(wait);
int ret; int ret;
if (io_cqring_events(ring) >= min_events) if (io_cqring_events(ring) >= min_events)
...@@ -2201,21 +2200,9 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, ...@@ -2201,21 +2200,9 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
return ret; return ret;
} }
do { ret = wait_event_interruptible(ctx->wait, io_cqring_events(ring) >= min_events);
prepare_to_wait(&ctx->wait, &wait, TASK_INTERRUPTIBLE); if (ret == -ERESTARTSYS)
ret = 0;
if (io_cqring_events(ring) >= min_events)
break;
schedule();
ret = -EINTR; ret = -EINTR;
if (signal_pending(current))
break;
} while (1);
finish_wait(&ctx->wait, &wait);
if (sig) if (sig)
restore_user_sigmask(sig, &sigsaved); restore_user_sigmask(sig, &sigsaved);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment