From nobody Tue Dec 16 22:14:30 2025 Received: from mail-pf1-f225.google.com (mail-pf1-f225.google.com [209.85.210.225]) (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 908E12EB845 for ; Mon, 15 Dec 2025 20:10:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.225 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765829430; cv=none; b=flbzihnjnWTJQFKV+CmmC9BeRpwcgfOj855y0n2FhRDxZlJKiudpZpwUFGOpEmMgWTRmuN4pZvAphQ2AMxnTTCsQA/0demniK9P/7ocyssoqiOQOMYhPdJGkR0oCbB+LDt7SfJ71J5UdSrfwvHc12kBRQhFm10/H4lDhTBegDZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765829430; c=relaxed/simple; bh=mCH4UHXC/WywxK2XbUmSCE7uuYnugHpAiJbLAuIlfJ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rRxMGBdWYQ4t4CiXEQOY5BEV/O7vAtbxzfLtgMQ3XHDsyIrue0nyS/51hCOSvfcr22HrW5n0j/Ob/vtpxY3a/TTTrodiotb56VD3XlRftxRBD3UIKrquQ6HrZzZmNKrRkWHBf6aETDjJZ6jckFlw42UkQXUS47bP/sGiVupgl6M= 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=fb261Wwr; arc=none smtp.client-ip=209.85.210.225 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="fb261Wwr" Received: by mail-pf1-f225.google.com with SMTP id d2e1a72fcca58-7baa28f553dso105239b3a.3 for ; Mon, 15 Dec 2025 12:10:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1765829428; x=1766434228; 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=tc5cAPWLhKrkCI4CYdzzTi0ug0E8D643Rd4mnx3PNyc=; b=fb261Wwr26iDMrjN6rRp2/liMKX/YtdRsmRn/uT0qzoM+f2BFZ6ehBwdsrtPeLExcv 6Yf2gfHdA+qQu3jr5jdvtHmqW34hjOS8oWSiNuLnEOfrcT8xeIIGNs9pqraSxbnmVm5w o1npCKyYDGYgC9539CsH5TMYS53k2GnFjhfIdq3N3leWivXy0vq8s7BgAv5Tz36K/oye c5/ZiYVT5I+ilu8sWP6fGAvfBpDO+q3Uxo2K/HqKyOdjzS6pMRcBA8T0Lwf1OMUNqiSE 2MbVbs+FNpl/1FXWT0GYjzCwzryDIyYtwrFDZcgzmTLatIyQL6GHHX7x5fVc9FGFr4QL NxRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765829428; x=1766434228; 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=tc5cAPWLhKrkCI4CYdzzTi0ug0E8D643Rd4mnx3PNyc=; b=Wb5mJ2RvHoZVRJRolHGkDBrnyttJ8YyVP35AFI9G1XCv9Qf+H9Leso2bxtfuIQ0enT 7zkiggNUkUtO+ujC2bKF9Hl5nADZnkkcyejWyRq1h049kQRcpWplXzxvdR2697JQf6LS zVwxXi8JMkW0uat2HVHpM5CVLSukQsnzeDmA7YtCFr3RgFA3Jj4hic/Z/5ZqmvnhK1eY TLZM9L1jOIRhbpPSvn2lcHZ2CLyEyh9eZ8YGXN/zbvi3+w+69mGL+1psR8qRlKJ5pMPX zRHFzKblQ0V+MYbTiPa4IuVgaXLU9nr/VApnGVYaPqycAFsCiDFHxUh60a2+DMqyRtdb NbZw== X-Forwarded-Encrypted: i=1; AJvYcCVVscVhMj9u+wL89XP9fWwQmblic7nqSNzZL7HQR1D+6a7zuQPKiFmF/eJm4gdNykivXPZ2FstWIuOoKlo=@vger.kernel.org X-Gm-Message-State: AOJu0YzwudjoVfYfZ4rDrOuJ+n5s43a38GzsVe+i6oFLS99N2emi+hoT 0uoVreX2HWaCjcyAksiiGRg1Saimgrux3zGjMBM5CUNNR6oM952q3VjeLnuL5JU5qEsqmELWkp5 CzmYV8W1xMokCUEKkxtpfkBNyvjMamDJk0+uTYETYJzDHHXDmDyL0 X-Gm-Gg: AY/fxX6b33+rWehBktmU1uhwdJlu6BNJpD9A4KQCGcAeaO981raj66weCb3TeafTcVp l1c1Qam1meQUyQvtSoA98mcUquBqHVg1iuaVjEONYnu8je1oWMR55A+JwdQ9S4f179a0d83Y68P 1ujT51HYnHis6VLu78v2vu86kJHTr/3yvJ5U2JKcF7Fe+nU1P5v3ugrQgCJGlfKrl6/IgE48t0D yM7RwvoCGQ6Hnyi5xF7AUT161rgeCAqU5eEi6x41B5zIh7LXovM1/lOcRiG2qOu4Or35wSk4oa+ VFyNn8J9n8ZZA6PO3rnwONyS/3AE9c/+zvlcdmgpXkwo115gfR2UuTEpCS1uDxH/RhKeI3T+bDV imqEa8/7yZTMQ1ffCs52dkLJB7X0= X-Google-Smtp-Source: AGHT+IEGuk3sz77FXrQmCpSJFrQkto4AKlscE81EjDJnI5PpcY4ooIEl2sS/zT/JoK6BwdRaXQJ+J4oVa0Ls X-Received: by 2002:a17:903:11d0:b0:297:e67f:cd5 with SMTP id d9443c01a7336-29f23ca7d97mr83328505ad.7.1765829427722; Mon, 15 Dec 2025 12:10:27 -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 d9443c01a7336-2a0a4a6163fsm11123395ad.38.2025.12.15.12.10.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Dec 2025 12:10:27 -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 45722341FDC; Mon, 15 Dec 2025 13:10:27 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 4040EE41D23; Mon, 15 Dec 2025 13:10:27 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Joanne Koong , Caleb Sander Mateos Subject: [PATCH v5 4/6] io_uring: use io_ring_submit_lock() in io_iopoll_req_issued() Date: Mon, 15 Dec 2025 13:09:07 -0700 Message-ID: <20251215200909.3505001-5-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20251215200909.3505001-1-csander@purestorage.com> References: <20251215200909.3505001-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 Reviewed-by: Joanne Koong --- 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 6d6fe5bdebda..40582121c6a7 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1670,15 +1670,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. @@ -1701,11 +1699,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