From nobody Thu Dec 18 12:30:10 2025 Received: from mail-lf1-f98.google.com (mail-lf1-f98.google.com [209.85.167.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADD27288CA3 for ; Tue, 2 Dec 2025 16:41:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.98 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764693694; cv=none; b=K2yEaGtS58A5r3MpF5O8LF3xkzphXlQJmrRo5bRcGUXdlHFQER981S5j/FQrjJTN0ONA19p7Y5rTAjYzeB3SCuekHkP3cWot7JZjqAarxw8kIBSaAOVMpraslNXeRGZ5aVjBKEEPIAmSIC5qMEcJc0orYkWu/8ZYJiAlSwN+EEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764693694; c=relaxed/simple; bh=oJ3TB2bE5K/CW3N3AxH8QvgLVVXrWJFnX4vH0ILQxFM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j8h8G1lXkkPKFouMfQcYhlriJjKk4JJ26yUDo4V2V/DN72f8FpZgOUH/fB8CnfzvoA7RMuPlT27zsLF6EIS3yX5764pDNHSHqiGucjw8XLiuYN8cSNfYDFrn5yqYjZuLMy/IR9Dl7WxBxmFflB49j8DWDQET7hLXIDkeDm8KBto= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=O9MRYuyk; arc=none smtp.client-ip=209.85.167.98 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="O9MRYuyk" Received: by mail-lf1-f98.google.com with SMTP id 2adb3069b0e04-5957f5e2755so438200e87.3 for ; Tue, 02 Dec 2025 08:41:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1764693691; x=1765298491; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rY5nvju4bFOTuCq7sD6Wpn9mpxfHxv1vMUw6znMOr3Y=; b=O9MRYuykOSNrdzqWDrU41hqQdCEmSRPqBCWC9tk3ECySIMjEcgmywjfHjgTfqdxBs0 dtL1wm75oHWDBKv6n/hbii7CaYvVWLx7bW8Vud2R0B1xlzoANWrpYm1l3wOuRqKWPo1Z Gl7FrWMi/Azefm3t854cX/zQwp1WIFhwgjiDd6yDVZ4x7mQuqM0ttyJrSHa8NFbtbGdh 8ouzrBxzb2QgogPXx13EKsQK+gvuM2dVfhrWFsNdQu5wN5Dn+pe0kucATuLnks8NbNqW 7ZICAQIDTyK40wwA+HnL3NE8DJpmLYqkanhwEUmbep4qlm8aOKY84odfwjgucn5XBKMY Yb7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764693691; x=1765298491; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rY5nvju4bFOTuCq7sD6Wpn9mpxfHxv1vMUw6znMOr3Y=; b=D1ReT5601ispzK+cIkIBNzzxJLR2Ybi6EWT28ubB2lRcHLXg7K0z1bGNASFQI7c8MB VYAhArXBEdO1PHYqSMdBxd5HewoGdUoewFZ8QnVDKaFbPveRBHbjdG+Jw/6fvKvM6K8M W5uRv7kMOOfnNrlunh0ACa4iv97tmoL1TCvBH5rl1mWFrk13EYeg+0t2Ies2ha8ti2Sm aT0SvYtYkRBKTdB0yYUfY69zLUOXghAecLez/SkN+BR76SSdZwWeIW4/RRyPle5lbU42 6fqMRC+Fa9QI6FCoWgS5kkMDTRLMcVm4SqYI0OZlo0RJioIT1/SuW2swJVuL/aH5B6q4 mECg== X-Forwarded-Encrypted: i=1; AJvYcCXZ1d9fQ9J7CpHtzFSagUBFy9RYSRob8SMr3DSvyEOho4wILRLSlrub4kGhH55oSOhdzuUKewzQxPdqj6c=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3n1NkmzfdEQgKc8zGTQDbK/GsE/ODTKzeYfnY8dpKv6XnXYtB 8NCOihF/zUYD/WcC0PdPh4+PyeHBFElXtWgHQ7G5Qa/CkE/WvvWB4bs8eXhIdhq3CIs2TAl2Le/ ZkndkfIbowz2r2WYd1SIFfxRObKLKEZs4Z+4HACBdlf0ICgQJhIXW X-Gm-Gg: ASbGnctLizMzvJ4LvRGeaiYtfhffrCG4eMK4LAc3F/J5VKbvVZlNyjo6NCtpHptNGSl rOlKKi+xvO2itmu1Aqlliqp2HfUOH7YrA/K0MiZdETRSHSCCKImP8ocywbmuTDr1i1jEEq9m86I srQE9uTmGXPCDZmkiBvyWpBKI44y5mjw8cAHk3i9r5+Dy539WHDdA2DXofCcuS2xbP2sSROt4hU kAqvqL1jEdyjra3uEudC/35l/ydjVAwcAeeIVKtTbJ15qK301hdouNQE8yehRc6XuwEYC8jK76u o8lS6n4deYq5NeYybgDzO3KHuFqUE6n8C67zZ01OxrL11YhblNK+O1aNrJpwuE2ER332Qshvpc+ +f5uZUcUGwhg7E3jEQL5EeDtUxhM= X-Google-Smtp-Source: AGHT+IH32fycXq7x1oe6vlJMhxWCBP3eopr1dCNAYJyAgc83mxf/MhAxWqVF7/COHjOy3hK3lJhiKzOPbVqd X-Received: by 2002:a05:6512:3b8c:b0:595:83c6:2228 with SMTP id 2adb3069b0e04-596a3e6371amr6575836e87.0.1764693690591; Tue, 02 Dec 2025 08:41:30 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([2620:125:9017:12:36:3:5:0]) by smtp-relay.gmail.com with ESMTPS id 2adb3069b0e04-596bfa48ad9sm2523301e87.46.2025.12.02.08.41.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 08:41:30 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (unknown [IPv6:2620:125:9007:640:ffff::1199]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id D0F7D340505; Tue, 2 Dec 2025 09:41:28 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id CF016E41DB4; Tue, 2 Dec 2025 09:41:28 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH v4 3/5] io_uring: use io_ring_submit_lock() in io_iopoll_req_issued() Date: Tue, 2 Dec 2025 09:41:19 -0700 Message-ID: <20251202164121.3612929-4-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20251202164121.3612929-1-csander@purestorage.com> References: <20251202164121.3612929-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the io_ring_submit_lock() helper in io_iopoll_req_issued() instead of open-coding the logic. io_ring_submit_unlock() can't be used for the unlock, though, due to the extra logic before releasing the mutex. Signed-off-by: Caleb Sander Mateos --- io_uring/io_uring.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index d0655082ced3..42ac03b56725 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1668,15 +1668,13 @@ void io_req_task_complete(struct io_tw_req tw_req, = io_tw_token_t tw) * accessing the kiocb cookie. */ static void io_iopoll_req_issued(struct io_kiocb *req, unsigned int issue_= flags) { struct io_ring_ctx *ctx =3D req->ctx; - const bool needs_lock =3D issue_flags & IO_URING_F_UNLOCKED; =20 /* workqueue context doesn't hold uring_lock, grab it now */ - if (unlikely(needs_lock)) - mutex_lock(&ctx->uring_lock); + io_ring_submit_lock(ctx, issue_flags); =20 /* * Track whether we have multiple files in our lists. This will impact * how we do polling eventually, not spinning if we're on potentially * different devices. @@ -1699,11 +1697,11 @@ static void io_iopoll_req_issued(struct io_kiocb *r= eq, unsigned int issue_flags) if (READ_ONCE(req->iopoll_completed)) wq_list_add_head(&req->comp_list, &ctx->iopoll_list); else wq_list_add_tail(&req->comp_list, &ctx->iopoll_list); =20 - if (unlikely(needs_lock)) { + if (unlikely(issue_flags & IO_URING_F_UNLOCKED)) { /* * If IORING_SETUP_SQPOLL is enabled, sqes are either handle * in sq thread task context or in io worker task context. If * current task context is sq thread, we don't need to check * whether should wake up sq thread. --=20 2.45.2