From nobody Fri Dec 19 06:39:14 2025 Received: from mail-oa1-f100.google.com (mail-oa1-f100.google.com [209.85.160.100]) (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 29D442FDC25 for ; Thu, 18 Dec 2025 02:45:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766025908; cv=none; b=bm7btFP1dABWzxeHhyU8VDgx7VYZ0hMQSQ9u4g6lwk5m7wdyKXjlVPaAYOAW/Eh62kKFdNeqF/XoFU51S+Ukdl+wmuVQbpHchgr+3A9GCx+C3ccoch85TQ2JTjeIi9YTmVRCQ17UtkikR1Lmvhej7gR1zSbrZxXcjG+kBQy+lwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766025908; c=relaxed/simple; bh=LbZ3r1FO6blMuhfRxt6WhD9bltWwdniPdYHLHEt70jo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GpcE23MrpTrhStYamQIe9txvdQ8gVY38ueKTmDoF9SgF0yGCx74SSgTFWJN+bqA4ZszBzRMCNQChCufwiJ65WLG/61+dRC6y9xybw00IOtztkemmRaFs5ARVK4xHaZ+9sBfF/HcY13FM+dFT/l/W2KFpS2NiIRB8VP5ENCH1N5I= 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=KcQclCoL; arc=none smtp.client-ip=209.85.160.100 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="KcQclCoL" Received: by mail-oa1-f100.google.com with SMTP id 586e51a60fabf-3e0ad5b4763so36625fac.1 for ; Wed, 17 Dec 2025 18:45:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1766025904; x=1766630704; 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=mD3XkocdNT/jKO6xXmN59qwRMEBa7RKDVtIkI8u+RTk=; b=KcQclCoL/mBdYeDppoQlpVkSxtg1rLz/YhOgv2DRj6nV+PeauSDRmoBtUGbJGI0/+S uG9AVh+FX0nKpeKRBagKJ9l/wKvsA5VG9kohY0ew2zVFUT4f2b6vcXFm9DyXgAEFvHbt G13ty3EvDTonEGkZTSu5zf7z9mshroSsiMM33CdpFxDXOh61dJb5h0yOLgZZLCXctoRe HDnDLftKjKOIUcakO3D1Sl+iz4T0HcZb3c2zZPWEYAb/CwY9rxqKG3MH0vdGrgUTb6W7 jI9yLbUqUpBQPuyf1y0ZMINmlnSo+IKA/9Jd9G0Kxdhpg4iqehJE95BXF6AMhQBxbyDk a3tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766025904; x=1766630704; 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=mD3XkocdNT/jKO6xXmN59qwRMEBa7RKDVtIkI8u+RTk=; b=LKKi8wNRwAcO04+QgsjoHai8nH0YsCycS/6Ktysr50oPdKVbZvzknknboQpknsxlq6 9+sovz9g/TOnKxNU364IdMwl7viJD3OVtx1LIVaMsYcYSkQfUpUssQSFWP+QjSMFtyQc wnXQgH+5WD/LWzwRWRC1gfyYOxycwuVy27vJLg01Hdo/rhsdyP8q+SzpN5267xnGzVtw 2CTxfdkERYBDEoydRPH/kdUZBxGm5Dz3xQIXP+It2nUNHtdHr2xEASwSUsjUF7QrSANj zSl0Hqcm/nSAyCVIaSCeZjQowl2Gii8hkROLSPdJvHc0zYjX6noXBjemAC/3EXfF46Lp 127A== X-Forwarded-Encrypted: i=1; AJvYcCUKtAevZbWtsZXXKsGvhlv7j0gjHeOfEBTKWxrOeWCYgsoG3EJDX4waAPYApDg1MGVTu+0vnIvuEXvJJeA=@vger.kernel.org X-Gm-Message-State: AOJu0YwZ/zGnqerwclN2BiFsZF+tqIlBFFFgPzXVF5n6bX9SIfKLhl/9 azuB/mswKghLkhssnctm9xwzk9ORxZcZwXR4693wA6eSjIbvu16HGqKodsGOgynB869u73W1q4/ qvdmErVjeZQLSjWowMIL7ExOXQbUdXMBkTZO7 X-Gm-Gg: AY/fxX4Qt1GorVmSs3HmAHlTHuq+aUS35bLkqP/CVN+P/1QlRoWzKM3REepBe497X8k sW4ZAmPeCLJk746q0ucc34hT0kl/KO/8okycIjDAnZHWnW+4JkaizpC5SBd0bGQ93177vuYCFzr kAhmz+QAHcvk42RxxheRXofCS6Cb8dT16Ts2LRvBDE1C2OMyWfoyrgnZn36jHHIQQjjQ3ogsjCS Bc/YENIF09X3DhO98Zx1JoHPuZA7LUF4f9itqLJJTfUAqetCdsETbZXKQcnGDJykQ5QXfJwl+jR q7EWAzZ8wwJXBK0spn3DExkOs0u9Y1NhajaGJ98BHteDhvb0ro8Kdz8wkfWlU4rhFKF/PcFrKgt 2P6aaioRjVZE8iHTyhDk2X6FoaUH4Zla3fFfywSxfkQ== X-Google-Smtp-Source: AGHT+IErBFE11CWWforXCJrGX0oeKrN73fwb+L8zmbmh8PgxroZZBWNbtPisq6LiY5/QqEzyWv1mCKknEhT9 X-Received: by 2002:a05:6870:8327:b0:3ea:d0e3:9696 with SMTP id 586e51a60fabf-3fa1b14b6bbmr311098fac.9.1766025903797; Wed, 17 Dec 2025 18:45:03 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.129]) by smtp-relay.gmail.com with ESMTPS id 586e51a60fabf-3fa18031fe5sm124135fac.15.2025.12.17.18.45.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 18:45:03 -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 C824E340891; Wed, 17 Dec 2025 19:45:02 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id C68CDE41A49; Wed, 17 Dec 2025 19:45:02 -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 v6 4/6] io_uring: use io_ring_submit_lock() in io_iopoll_req_issued() Date: Wed, 17 Dec 2025 19:44:57 -0700 Message-ID: <20251218024459.1083572-5-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20251218024459.1083572-1-csander@purestorage.com> References: <20251218024459.1083572-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 22086ac84278..ab0af4a38714 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