From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C220C61DA4 for ; Mon, 6 Mar 2023 10:49:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229633AbjCFKtP (ORCPT ); Mon, 6 Mar 2023 05:49:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229846AbjCFKtN (ORCPT ); Mon, 6 Mar 2023 05:49:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5508220699 for ; Mon, 6 Mar 2023 02:49:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 00FD7B80D7F for ; Mon, 6 Mar 2023 10:49:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3655DC433D2; Mon, 6 Mar 2023 10:49:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678099748; bh=TY2/+KQ4VtkzQJKXxMtlpCpgvb0Xx9ThxiGPca8sM0o=; h=Subject:To:Cc:From:Date:From; b=O3V8/OZZ6MfKtq72a2DbwhqSWXi6CQH3qFNhCXQSIDhkzBTDR8i6i3gROlSV42eH5 YKCml/Yeac5gVr2JgeVgE4qZk+9MXzNvuBn4app5XbTvPnTY7CnhOt0ylNUSZ2it7I rIA80MSNAqZxDXoM6pztoSNwr4kSWUk9hdqbtg5k= Subject: FAILED: patch "[PATCH] io_uring: add reschedule point to handle_tw_list()" failed to apply to 5.15-stable tree To: axboe@kernel.dk Cc: From: Date: Mon, 06 Mar 2023 11:48:57 +0100 Message-ID: <1678099737150217@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x f58680085478dd292435727210122960d38e8014 # git commit -s git send-email --to '' --in-reply-to '1678099737150217@kroah.com' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: f58680085478 ("io_uring: add reschedule point to handle_tw_list()") c6dd763c2460 ("io_uring: trace task_work_run") 3a0c037b0e16 ("io_uring: batch task_work") f88262e60bb9 ("io_uring: lockless task list") ed5ccb3beeba ("io_uring: remove priority tw list optimisation") 4a0fef62788b ("io_uring: optimize io_uring_task layout") 253993210bd8 ("io_uring: introduce locking helpers for CQE posting") 305bef988708 ("io_uring: hide eventfd assumptions in eventfd paths") d9dee4302a7c ("io_uring: remove ->flush_cqes optimisation") a830ffd28780 ("io_uring: move io_eventfd_signal()") 9046c6415be6 ("io_uring: reshuffle io_uring/io_uring.h") d142c3ec8d16 ("io_uring: remove extra io_commit_cqring()") 68494a65d0e2 ("io_uring: introduce io_req_cqe_overflow()") faf88dde060f ("io_uring: don't inline __io_get_cqe()") d245bca6375b ("io_uring: don't expose io_fill_cqe_aux()") 6a02e4be8187 ("io_uring: inline ->registered_rings") aa1e90f64ee5 ("io_uring: move small helpers to headers") aa1e90f64ee5 ("io_uring: move small helpers to headers") aa1e90f64ee5 ("io_uring: move small helpers to headers") aa1e90f64ee5 ("io_uring: move small helpers to headers") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From f58680085478dd292435727210122960d38e8014 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 27 Jan 2023 09:50:31 -0700 Subject: [PATCH] io_uring: add reschedule point to handle_tw_list() If CONFIG_PREEMPT_NONE is set and the task_work chains are long, we could be running into issues blocking others for too long. Add a reschedule check in handle_tw_list(), and flush the ctx if we need to reschedule. Cc: stable@vger.kernel.org # 5.10+ Signed-off-by: Jens Axboe diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index fab581a31dc1..acf6d9680d76 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1179,10 +1179,16 @@ static unsigned int handle_tw_list(struct llist_node *node, /* if not contended, grab and improve batching */ *locked = mutex_trylock(&(*ctx)->uring_lock); percpu_ref_get(&(*ctx)->refs); - } + } else if (!*locked) + *locked = mutex_trylock(&(*ctx)->uring_lock); req->io_task_work.func(req, locked); node = next; count++; + if (unlikely(need_resched())) { + ctx_flush_and_put(*ctx, locked); + *ctx = NULL; + cond_resched(); + } } return count;