From nobody Wed Feb 11 18:51:13 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44546C6FD19 for ; Sun, 12 Mar 2023 14:41:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229502AbjCLOl2 (ORCPT ); Sun, 12 Mar 2023 10:41:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229845AbjCLOlR (ORCPT ); Sun, 12 Mar 2023 10:41:17 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29A6F4393B; Sun, 12 Mar 2023 07:41:16 -0700 (PDT) Date: Sun, 12 Mar 2023 14:41:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1678632074; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ySpyZOoTqzSKRmAKJo10i+xEae61uYIC7VjmoPx3Sdk=; b=uPLIiYrJgNP5eXFvhBHoRIk1RgiHA9bFXeQresLLondz3YStZgG0sRdwU8h7XgfRBkDbwQ NJlXh0ijpeC9tPmKF47xYvX4e/gTh/Y5+VQuLKQHH+gdX7WUMnA6cUfIZwIjjT5E8ulkTj FvU7FdPGYmo5JDdmIKCbPylfxfJ3h6jkZAPRcuHtcvvXDNyd/0hpGmHdYJcGZA2N04H8bx vDbhiIlukNyJlpJogTU3o3n67Vbt6Ob8qYivgVdHGb5S0+odJX0TZtIoogJrl+H+dTiSyd qi17+m4PzZq911R5Iwsi/NbFABCCR4lnXSNRHLjN+FqYUVsbYxhuZDy/4SUsLw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1678632074; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ySpyZOoTqzSKRmAKJo10i+xEae61uYIC7VjmoPx3Sdk=; b=d5rNLZP2BhRHQIiUsKOskLLrJdT7XH2TTrLDHS7QxM/IGuyWvNX69kqaJcUxXEKUwcice4 lsACW7gQwTHklOBA== From: "tip-bot2 for Andrzej Hajda" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] io_uring: use __xchg if possible Cc: Andrzej Hajda , "Peter Zijlstra (Intel)" , Andi Shyti , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230118154450.73842-5-andrzej.hajda@intel.com> References: <20230118154450.73842-5-andrzej.hajda@intel.com> MIME-Version: 1.0 Message-ID: <167863207362.5837.13623012047790271971.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/core branch of tip: Commit-ID: bd1e2670ebd10ad727b92ddd424cca270314f5ee Gitweb: https://git.kernel.org/tip/bd1e2670ebd10ad727b92ddd424cca270= 314f5ee Author: Andrzej Hajda AuthorDate: Wed, 18 Jan 2023 16:44:48 +01:00 Committer: Peter Zijlstra CommitterDate: Sat, 11 Mar 2023 14:03:59 +01:00 io_uring: use __xchg if possible Recently introduced helper simplifies the code. Signed-off-by: Andrzej Hajda Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Andi Shyti Link: https://lore.kernel.org/r/20230118154450.73842-5-andrzej.hajda@intel.= com --- io_uring/io_uring.c | 7 ++----- io_uring/slist.h | 6 ++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index fd1cc35..0cd89a3 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -1131,8 +1132,6 @@ static void __io_req_find_next_prep(struct io_kiocb *= req) =20 static inline struct io_kiocb *io_req_find_next(struct io_kiocb *req) { - struct io_kiocb *nxt; - /* * If LINK is set, we have dependent requests in this chain. If we * didn't fail this request, queue the first one up, moving any other @@ -1141,9 +1140,7 @@ static inline struct io_kiocb *io_req_find_next(struc= t io_kiocb *req) */ if (unlikely(req->flags & IO_DISARM_MASK)) __io_req_find_next_prep(req); - nxt =3D req->link; - req->link =3D NULL; - return nxt; + return __xchg(&req->link, NULL); } =20 static void ctx_flush_and_put(struct io_ring_ctx *ctx, bool *locked) diff --git a/io_uring/slist.h b/io_uring/slist.h index 7c198a4..051e577 100644 --- a/io_uring/slist.h +++ b/io_uring/slist.h @@ -2,6 +2,7 @@ #define INTERNAL_IO_SLIST_H =20 #include +#include =20 #define wq_list_for_each(pos, prv, head) \ for (pos =3D (head)->first, prv =3D NULL; pos; prv =3D pos, pos =3D (pos)= ->next) @@ -99,10 +100,7 @@ static inline void wq_list_del(struct io_wq_work_list *= list, static inline struct io_wq_work_node *wq_stack_extract(struct io_wq_work_node *stack) { - struct io_wq_work_node *node =3D stack->next; - - stack->next =3D node->next; - return node; + return __xchg(&stack->next, stack->next->next); } =20 static inline struct io_wq_work *wq_next_work(struct io_wq_work *work)