diff options
| author | Li Chen <me@linux.beauty> | 2026-02-02 22:37:53 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-02-16 10:19:40 +0100 |
| commit | f02693a40e40702cb6201145379e21634dfbe20d (patch) | |
| tree | 5e696d4449bfbd460cac58cdba81b195f52d49c1 /io_uring/io-wq.h | |
| parent | 41cec610f690603820c80c4871dbb55bec77b9a2 (diff) | |
io_uring/io-wq: add exit-on-idle state
commit 38aa434ab9335ce2d178b7538cdf01d60b2014c3 upstream.
io-wq uses an idle timeout to shrink the pool, but keeps the last worker
around indefinitely to avoid churn.
For tasks that used io_uring for file I/O and then stop using io_uring,
this can leave an iou-wrk-* thread behind even after all io_uring
instances are gone. This is unnecessary overhead and also gets in the
way of process checkpoint/restore.
Add an exit-on-idle state that makes all io-wq workers exit as soon as
they become idle, and provide io_wq_set_exit_on_idle() to toggle it.
Signed-off-by: Li Chen <me@linux.beauty>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'io_uring/io-wq.h')
| -rw-r--r-- | io_uring/io-wq.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/io_uring/io-wq.h b/io_uring/io-wq.h index 774abab54732..94b14742b703 100644 --- a/io_uring/io-wq.h +++ b/io_uring/io-wq.h @@ -41,6 +41,7 @@ struct io_wq_data { struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data); void io_wq_exit_start(struct io_wq *wq); void io_wq_put_and_exit(struct io_wq *wq); +void io_wq_set_exit_on_idle(struct io_wq *wq, bool enable); void io_wq_enqueue(struct io_wq *wq, struct io_wq_work *work); void io_wq_hash_work(struct io_wq_work *work, void *val); |
