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 0AE1DC678D4 for ; Mon, 6 Mar 2023 10:48:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229619AbjCFKsY (ORCPT ); Mon, 6 Mar 2023 05:48:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229558AbjCFKsX (ORCPT ); Mon, 6 Mar 2023 05:48:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C885A5EE for ; Mon, 6 Mar 2023 02:48:22 -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 dfw.source.kernel.org (Postfix) with ESMTPS id EC93460DE6 for ; Mon, 6 Mar 2023 10:48:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 029DEC433D2; Mon, 6 Mar 2023 10:48:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678099701; bh=PlipNsHXrIHlC/Ps6ZYlfURxNSoHU01NOBwQaDIiFIE=; h=Subject:To:Cc:From:Date:From; b=qSJcIVvLHgX6orrSAYpJbmQvY6OLLCdUbfw1CuOrH7uejJF2ys3DlyDdc71p73tOF pj4w/62NIIdgP4Uy5YhoDQ+QkH4OAJZSzmOfAVQ9wufkaK/U25j1py+/3O9CCKOVn8 ORW+262OMjIhlfSxQlLvCXEg56+kFuZQ3+Y2TxWA= Subject: FAILED: patch "[PATCH] io_uring: handle TIF_NOTIFY_RESUME when checking for" failed to apply to 5.15-stable tree To: axboe@kernel.dk Cc: From: Date: Mon, 06 Mar 2023 11:48:18 +0100 Message-ID: <16780996985892@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 b5d3ae202fbfe055aa2a8ae8524531ee1dcab717 # git commit -s git send-email --to '' --in-reply-to '16780996985892@kroah.com' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: b5d3ae202fbf ("io_uring: handle TIF_NOTIFY_RESUME when checking for task_work") 7cfe7a09489c ("io_uring: clear TIF_NOTIFY_SIGNAL if set and task_work not available") 46a525e199e4 ("io_uring: don't gate task_work run on TIF_NOTIFY_SIGNAL") c0e0d6ba25f1 ("io_uring: add IORING_SETUP_DEFER_TASKRUN") b4c98d59a787 ("io_uring: introduce io_has_work") 78a861b94959 ("io_uring: add sync cancelation API through io_uring_register()") c34398a8c018 ("io_uring: remove __io_req_task_work_add") ed5ccb3beeba ("io_uring: remove priority tw list optimisation") 625d38b3fd34 ("io_uring: improve io_run_task_work()") 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") affa87db9010 ("io_uring: fix multi ctx cancellation") 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()") ab1c84d855cf ("io_uring: make io_uring_types.h public") 68494a65d0e2 ("io_uring: introduce io_req_cqe_overflow()") faf88dde060f ("io_uring: don't inline __io_get_cqe()") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From b5d3ae202fbfe055aa2a8ae8524531ee1dcab717 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 24 Jan 2023 08:24:25 -0700 Subject: [PATCH] io_uring: handle TIF_NOTIFY_RESUME when checking for task_work If TIF_NOTIFY_RESUME is set, then we need to call resume_user_mode_work() for PF_IO_WORKER threads. They never return to usermode, hence never get a chance to process any items that are marked by this flag. Most notably this includes the final put of files, but also any throttling markers set by block cgroups. Cc: stable@vger.kernel.org # 5.10+ Signed-off-by: Jens Axboe diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h index c68edf9872a5..d58cfe062da9 100644 --- a/io_uring/io_uring.h +++ b/io_uring/io_uring.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include "io-wq.h" @@ -274,6 +275,13 @@ static inline int io_run_task_work(void) */ if (test_thread_flag(TIF_NOTIFY_SIGNAL)) clear_notify_signal(); + /* + * PF_IO_WORKER never returns to userspace, so check here if we have + * notify work that needs processing. + */ + if (current->flags & PF_IO_WORKER && + test_thread_flag(TIF_NOTIFY_RESUME)) + resume_user_mode_work(NULL); if (task_work_pending(current)) { __set_current_state(TASK_RUNNING); task_work_run();