From nobody Tue Dec 2 00:02:43 2025 Received: from mail-il1-f226.google.com (mail-il1-f226.google.com [209.85.166.226]) (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 9EABB2F25E8 for ; Tue, 25 Nov 2025 23:39:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764113983; cv=none; b=EFPrruan50+xYZa54mURNZPTVxDef0cPypTD9Db1j0b3DeXGfO3eVZNT4lEEA8e6W71YZpTB9h3A0eWCT6DUdU45B1w0XEZtgAlHUleKqUEZeaMqNymRLNapcN3Sz6YpLQZXC+mPbtvneXNFKUyH28l97GzVavBe9TGHU53EE+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764113983; c=relaxed/simple; bh=mgPhKwAnmtPP9Wj/BsLLAsVvewiMBMYtCRp0h5FCiVQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nlOhRP42+yl4L1Gslfk0HmJg+zThT/hEMufvlEQx8SO9T9lGo0N1ZAv38M3nsoirZUpZmGc0LaL9qWnf/DnsR5aWPkcVN3Zg/Azwwl8iT10gRrOj+XfEmQwRgLWH8gdXCmQ97ZPi2vfglkR+Sv2fKw06ihNsQq4poMCjEZVe1gU= 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=KZscNG0l; arc=none smtp.client-ip=209.85.166.226 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="KZscNG0l" Received: by mail-il1-f226.google.com with SMTP id e9e14a558f8ab-43326c45389so2516635ab.1 for ; Tue, 25 Nov 2025 15:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1764113981; x=1764718781; 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=KFHAjnVVu+TK64nKRWtxECUF1AnC7SKDeYJZioBUuxI=; b=KZscNG0lYtIfBR6CMm/GV4sJy2rcQKMKcUCixG00wSN7no6vLAHLkeMkxtuEQP8UAE afD1W5dU8oKmdep0bBnQRNp6dGMvoHOP8KMxiQRuIe0Da4MQ1+cpZQGy6zL1VwWSaEL9 Sz1RUpTkcT3ClUWKy/wPla5P+Lrjh9NikfMz6ctwpwQ18TcSX7YdgYZ5onEpdV74btDx wRXfThDp2dhcd5fj3wuVr2ohcBb0A1iELWds3CwwYerEjC3z12D/kBuaS8qanpL+MtaV nP1WnhvkjgkyC0gRFXwps/RrJZf6hceXUYOAj647++coQ0ZLGL7xPDFzkgGupMthSVc4 6YZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764113981; x=1764718781; 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=KFHAjnVVu+TK64nKRWtxECUF1AnC7SKDeYJZioBUuxI=; b=W0jFgAVVZBw5dq5VM/0VzusUgIy13K0qkHL6+qhyYJ1oQFhjxof+dPbkHUp9gggCWe o2wFgvdGFXiUYdkvl+U7XVj6ey2ORCrK7yOA3LYgA9UNPeIK+pOymQDgME+1PI9AOpE5 bD3TifxRlR2jkPMzwkncI05ddDJMH39/lI8v86rDMfKFZ9XWmvyA5BccwkaXCa2Mb1G3 6AVnx1cZrGbcERg7RypDyA47moz4l1v4A87CqXyK4q2VKb2T7Ej4+WT9/5UajGz0wESJ N4s2gY81PhUaGx5Nm3R8QyXI84MT81OZnip2sF4kyQ9PEphCZKycXSddeWoa047D9aHb ktYw== X-Forwarded-Encrypted: i=1; AJvYcCU/4fO8uWJtcdIEdQPLzgwr5IvWd2u77yCb//3r+jcCcdWDgH08+ZR4d9eXb3adhH5lmhVAHuqBEDyJKX0=@vger.kernel.org X-Gm-Message-State: AOJu0Ywqx36CKDCHZg6PauYwnDx8LR6BJwkTTsaPzF5Zh/X3eGtUsfps VHmQdf+DStQEfkAUZySzGJNcGvI/QMAJDD0ngzlu+AQnBgbUo5zWt2OHO9H64TgyOKXzDfJ4V08 i2gstZIm1irIEdQYjls+t7gQXPcAWZCW38yArHecffIEi+FK840KR X-Gm-Gg: ASbGncv1YcQOn1WHBdRQ36YTEbK4l324/6bD09GLs0O2IG4FSGn54ukDkoPP6FSdfjq X2T0JxSoaHK4lUfenNXP+1OOxfURmq4UJwRjwH2jhIberJG94gaKfWd9WqlkCpbbTgAjkfFlfa/ WNVXYKt+DuOgbCxRSiMQHmGnU6ndMAUJ8SS1Dpkix5ZyCJI1LiiuCs1HbWrDDs6CeOZOELMcNsP piZRlcQBtPJuLwobvnakX2vnq24NjLA5f4vDhBQo4bkNv0eumLUzGRsreYzviRt0QPT3Kh+9Rmf D6n9DEtuGAm9JPvHxUY8FiR37+E+pvf8G3EWxJMZqpDgz3RfpwnNfxwN8JVsnYxOTPWBCitF3TW u7qDtybnbOtXAFW0J4qctjHSWrfQ= X-Google-Smtp-Source: AGHT+IH/tX/rq3Q2X3Eh+XOimgjJ0hdijdnwQpq75jxvf3kyffpFKnT9Ejd21O5fcbveGv5SUPSnmPLKoauH X-Received: by 2002:a05:6e02:188e:b0:433:2fe2:9d41 with SMTP id e9e14a558f8ab-435bc9beca3mr60278395ab.7.1764113980755; Tue, 25 Nov 2025 15:39:40 -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 e9e14a558f8ab-435a90afcc0sm17207965ab.23.2025.11.25.15.39.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Nov 2025 15:39:40 -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 0E9C33400AF; Tue, 25 Nov 2025 16:39:40 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 0AEAFE42207; Tue, 25 Nov 2025 16:39:40 -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 v3 2/4] io_uring: use io_ring_submit_lock() in io_iopoll_req_issued() Date: Tue, 25 Nov 2025 16:39:26 -0700 Message-ID: <20251125233928.3962947-3-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20251125233928.3962947-1-csander@purestorage.com> References: <20251125233928.3962947-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 05a1ac457581..d7aaa6e4bfe4 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