The patch below does not apply to the 5.10-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 stable@vger.kernel.org.
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.10.y git checkout FETCH_HEAD git cherry-pick -x b5d3ae202fbfe055aa2a8ae8524531ee1dcab717 # <resolve conflicts, build, test, etc.> git commit -s git send-email --to 'stable@vger.kernel.org' --in-reply-to '1678099699105122@kroah.com' --subject-prefix 'PATCH 5.10.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 axboe@kernel.dk 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 axboe@kernel.dk
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 <linux/errno.h> #include <linux/lockdep.h> +#include <linux/resume_user_mode.h> #include <linux/io_uring_types.h> #include <uapi/linux/eventpoll.h> #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();
linux-stable-mirror@lists.linaro.org