From: Pavel Begunkov Date: Sun, 28 Feb 2021 22:04:54 +0000 (+0000) Subject: io_uring: replace cmpxchg in fallback with xchg X-Git-Tag: baikal/mips/sdk5.9~11393^2~21 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=3ec82f5e319969112f4274cfcf794f9bd2cb1647;p=kernel.git 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 Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 62a73543ab864..57c7833ba62be 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;