Skip to content

Commit 28c4721

Browse files
isilenceaxboe
authored andcommitted
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>
1 parent 2c32395 commit 28c4721

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

fs/io_uring.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8484,15 +8484,11 @@ static int io_remove_personalities(int id, void *p, void *data)
84848484

84858485
static bool io_run_ctx_fallback(struct io_ring_ctx *ctx)
84868486
{
8487-
struct callback_head *work, *head, *next;
8487+
struct callback_head *work, *next;
84888488
bool executed = false;
84898489

84908490
do {
8491-
do {
8492-
head = NULL;
8493-
work = READ_ONCE(ctx->exit_task_work);
8494-
} while (cmpxchg(&ctx->exit_task_work, work, head) != work);
8495-
8491+
work = xchg(&ctx->exit_task_work, NULL);
84968492
if (!work)
84978493
break;
84988494

0 commit comments

Comments
 (0)