1
0
Fork 0

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>
master
Pavel Begunkov 2021-02-28 22:04:54 +00:00 committed by Jens Axboe
parent 2c32395d81
commit 28c4721b80
1 changed files with 2 additions and 6 deletions

View File

@ -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;