FAILED: patch "[PATCH] io_uring: break out of iowq iopoll on teardown" failed to apply to 5.15-stable tree
Subsystems (2)
[email protected]
maintainerThe 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 <[email protected]>.
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 45500dc4e01c167ee063f3dcc22f51ced5b2b1e9
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023090945-mural-humming-67c0@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
45500dc4e01c ("io_uring: break out of iowq iopoll on teardown") ed29b0b4fd83 ("io_uring: move to separate directory") e0deb6a025ae ("io_uring: avoid io-wq -EAGAIN looping for !IOPOLL") 1d5f5ea7cb7d ("io-wq: remove worker to owner tw dependency") d01905db14eb ("io_uring: clean iowq submit work cancellation") 255657d23704 ("io_uring: clean io_wq_submit_work()'s main loop") 90fa02883f06 ("io_uring: implement async hybrid mode for pollable requests") 3b44b3712c5b ("io_uring: split logic of force_nonblock") 9882131cd9de ("io_uring: kill io_wq_current_is_worker() in iopoll") 9983028e7660 ("io_uring: optimise req->ctx reloads") 5e49c973fc39 ("io_uring: clean up io_import_iovec")51aac424aef9 ("io_uring: optimise io_import_iovec nonblock passing") c88598a92a58 ("io_uring: optimise read/write iov state storing") 538941e2681c ("io_uring: encapsulate rw state")d886e185a128 ("io_uring: control ->async_data with a REQ_F flag") 30d51dd4ad20 ("io_uring: clean up buffer select")ef05d9ebcc92 ("io_uring: kill off ->inflight_entry field") 6f33b0bc4ea4 ("io_uring: use slist for completion batching") c450178d9be9 ("io_uring: dedup CQE flushing non-empty checks") 4c928904ff77 ("block: move CONFIG_BLOCK guard to top Makefile")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 45500dc4e01c167ee063f3dcc22f51ced5b2b1e9 Mon Sep 17 00:00:00 2001
From: Pavel Begunkov <[email protected]>
Date: Thu, 7 Sep 2023 13:50:07 +0100
Subject: [PATCH] io_uring: break out of iowq iopoll on teardown
io-wq will retry iopoll even when it failed with -EAGAIN. If that races with task exit, which sets TIF_NOTIFY_SIGNAL for all its workers, such workers might potentially infinitely spin retrying iopoll again and again and each time failing on some allocation / waiting / etc. Don't keep spinning if io-wq is dying.
io_uring/io-wq.c +10 -0
@@ -174,6 +174,16 @@ static void io_worker_ref_put(struct io_wq *wq)complete (&wq->worker_done); } +bool io_wq_worker_stopped (void ) +{ +struct io_worker *worker = current->worker_private; + +if (WARN_ON_ONCE (!io_wq_current_is_worker ())) +return true; + +return test_bit (IO_WQ_BIT_EXIT , &worker->wq->state); +} +static void io_worker_cancel_cb (struct io_worker *worker) {struct io_wq_acct *acct =io_wq_get_acct (worker);
io_uring/io-wq.h +1 -0
@@ -52,6 +52,7 @@ void io_wq_hash_work(struct io_wq_work *work, void *val);int io_wq_cpu_affinity (struct io_uring_task *tctx,cpumask_var_t mask);int io_wq_max_workers (struct io_wq *wq,int *new_count); +bool io_wq_worker_stopped (void );static inline bool io_wq_is_hashed (struct io_wq_work *work) {
io_uring/io_uring.c +2 -0
@@ -1975,6 +1975,8 @@ void io_wq_submit_work(struct io_wq_work *work)if (!needs_poll) {if (!(req->ctx->flags &IORING_SETUP_IOPOLL ))break ; +if (io_wq_worker_stopped ()) +break ;cond_resched ();continue ; }