diff options
author | Jackie Liu <liuyun01@kylinos.cn> | 2019-05-16 05:46:31 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-05-16 16:10:27 +0200 |
commit | fdb288a679cdf6a71f3c1ae6f348ba4dae742681 (patch) | |
tree | 999a58292172b6ea599d7617c8078eac0b416074 /fs | |
parent | io_uring: adjust smp_rmb inside io_cqring_events (diff) | |
download | linux-fdb288a679cdf6a71f3c1ae6f348ba4dae742681.tar.xz linux-fdb288a679cdf6a71f3c1ae6f348ba4dae742681.zip |
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: Jackie Liu <liuyun01@kylinos.cn>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/io_uring.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 9cc7a101ef2a..383d208ca0d2 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -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; sigset_t ksigmask, sigsaved; - DEFINE_WAIT(wait); int ret; if (io_cqring_events(ring) >= min_events) @@ -2201,21 +2200,9 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, return ret; } - do { - prepare_to_wait(&ctx->wait, &wait, TASK_INTERRUPTIBLE); - - ret = 0; - if (io_cqring_events(ring) >= min_events) - break; - - schedule(); - + ret = wait_event_interruptible(ctx->wait, io_cqring_events(ring) >= min_events); + if (ret == -ERESTARTSYS) ret = -EINTR; - if (signal_pending(current)) - break; - } while (1); - - finish_wait(&ctx->wait, &wait); if (sig) restore_user_sigmask(sig, &sigsaved); |