From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379515; b=aiNf7pT7ZRqg0699Id98DsZG6H7EUjXbbXCejssRh/I2zbyyyZg10Q+2SNdPYP9VTgZR mNnD7BUmwzEZIuVVcKlzR64od4aqbZBKnJ9egH2KgkKxpfoPxFzlRapYeGPA9gGhVjMAY 60Xw3xqlap3ij9vu03QHpkPu6u1eGB4cgvwAdfyJnC+Zr7c7g+Jk2AHf5y0et6n4/Xb/b DUaqJ8Y8z7QVDFeTwgy9woltZ3gw8Dd0KDxqYCo7VwQSdapTrVM7H2+Zg3AAo9q98zx3Y qPD84HqizRbud7XcY7KNES8XfgPTuEgmjYo9Ogk0JnfmuasyucowpL+vfdh/qMiUKXg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379515; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=UNFg4FmsAokHx6gPLYMUHmm3Q+ty8mXb2uehC7EoEDM=; b=KNPpqNyWXYLOROAovrKSUwDHrhf7MUuf8rwFJZw8Ck0JEV5IEky8f5vijUHwxl7CjGIw LARMSmCCqrPoNF8niWjt7ZdDyx+bnuitqh7L00O80BXVhsqbf9R5jYDnOphMOqUGoCgac NONXS1x/aEBIxYHztegq+qdHzNWKNE/NGqSleLX0S2a2NFKY804fyo9Gw7lEu922PmnDH oyso9zZn/4NKA8CgolWRqW8/2Bmu87Elu1uQEMxJdj/boyZzONL42V0Lw+XqwnvsB8KtG jZ0vyPuXYijj7O0KPthuYh43ItlnULRHAnVuyv+UMWu461fH9mK8b6vE3G70QQnUDnA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=WeX2qRaX; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94576606A322; Fri, 4 Dec 2026 10:18:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=WeX2qRaX Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CE4F1F000C2; Fri, 4 Dec 2026 10:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379515; bh=UNFg4FmsAokHx6gPLYMUHmm3Q+ty8mXb2uehC7EoEDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WeX2qRaXDny1ORARdvwlw6Ut8PbtAY0bGCY6Zumpp8logAXNHxJSZHY6kbGgBI0c7 b+A2ZtsLeMFT76Q5kKqro5l9Ro+jAjS6ZPBL8PGuAiCdvQJqb4B5H/j5aYcm2W5+s3 +5TByRjbyfXle8RBhIM2E4BctnPbENEoshc6unBk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jens Axboe , Sasha Levin Subject: [PATCH 6.6 0025/1167] io_uring/sqpoll: use the correct check for pending task_work Date: Fri, 4 Dec 2026 18:50:52 +0900 Message-ID: <20261204100702.701037589@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jens Axboe Commit c8d8fc3b2d9d4c81e3d3b23eca504ad713a91219 upstream. A previous commit moved to using just the private task_work list for SQPOLL, but it neglected to update the check for whether we have pending task_work. Normally this is fine as we'll attempt to run it unconditionally, but if we race with going to sleep AND task_work being added, then we certainly need the right check here. Fixes: af5d68f8892f ("io_uring/sqpoll: manage task_work privately") Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- io_uring/sqpoll.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/io_uring/sqpoll.c b/io_uring/sqpoll.c index 716cb3cc7e2c0..ecd336c373b15 100644 --- a/io_uring/sqpoll.c +++ b/io_uring/sqpoll.c @@ -261,6 +261,13 @@ static unsigned int io_sq_tw(struct llist_node **retry_list, int max_entries) return count; } +static bool io_sq_tw_pending(struct llist_node *retry_list) +{ + struct io_uring_task *tctx = current->io_uring; + + return retry_list || !llist_empty(&tctx->task_list); +} + static int io_sq_thread(void *data) { struct llist_node *retry_list = NULL; @@ -324,7 +331,7 @@ static int io_sq_thread(void *data) } prepare_to_wait(&sqd->wait, &wait, TASK_INTERRUPTIBLE); - if (!io_sqd_events_pending(sqd) && !task_work_pending(current)) { + if (!io_sqd_events_pending(sqd) && !io_sq_tw_pending(retry_list)) { bool needs_sched = true; list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) { -- 2.53.0