From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D5E8BA3E for ; Tue, 7 Mar 2023 17:47:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 753CEC433D2; Tue, 7 Mar 2023 17:47:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678211234; bh=gb6m6q7eJ7vrIpStGuM1hl7wRfb5hqwy+aLdckHBeXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kAMAjWW/cL2F1hd6ddVpkv3HfP2WMduCYPNtgPo+SzRQMfrq0lzcbwawYCeHpZXXx 8x4zK/ivMwt76iC+5qS2ZL/b0CWsanBGDhc7bhagsfSX7v0A6z5v20plS7Frz9RxaZ 0Y0E/DU6HrUT3UebO1IsJb+hdE7Pd1BirrnhAjhw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jens Axboe Subject: [PATCH 6.2 0756/1001] io_uring: handle TIF_NOTIFY_RESUME when checking for task_work Date: Tue, 7 Mar 2023 17:58:48 +0100 Message-Id: <20230307170054.526787657@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307170022.094103862@linuxfoundation.org> References: <20230307170022.094103862@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Jens Axboe commit b5d3ae202fbfe055aa2a8ae8524531ee1dcab717 upstream. 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 Signed-off-by: Greg Kroah-Hartman --- io_uring/io_uring.h | 8 ++++++++ 1 file changed, 8 insertions(+) --- 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" @@ -270,6 +271,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();