aboutsummaryrefslogtreecommitdiffstats
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-02-28 22:04:54 +0000
committerJens Axboe <axboe@kernel.dk>2021-03-04 06:37:14 -0700
commit28c4721b80a702462fb77373c23428ee698fa5dd (patch)
tree52545987ce2510ac64d919ccae9bba6e0c051031 /fs/io_uring.c
parentio_uring: fix __tctx_task_work() ctx race (diff)
downloadlinux-dev-28c4721b80a702462fb77373c23428ee698fa5dd.tar.xz
linux-dev-28c4721b80a702462fb77373c23428ee698fa5dd.zip
io_uring: replace cmpxchg in fallback with xchg
io_run_ctx_fallback() can use xchg() instead of cmpxchg(). It's simpler and faster. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r--fs/io_uring.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 62a73543ab86..57c7833ba62b 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8484,15 +8484,11 @@ static int io_remove_personalities(int id, void *p, void *data)
static bool io_run_ctx_fallback(struct io_ring_ctx *ctx)
{
- struct callback_head *work, *head, *next;
+ struct callback_head *work, *next;
bool executed = false;
do {
- do {
- head = NULL;
- work = READ_ONCE(ctx->exit_task_work);
- } while (cmpxchg(&ctx->exit_task_work, work, head) != work);
-
+ work = xchg(&ctx->exit_task_work, NULL);
if (!work)
break;