On 8/21/24 15:16, Jens Axboe wrote:
In preparation for having two distinct timeouts and avoid waking the task if we don't need to. Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> --- io_uring/io_uring.c | 37 ++++++++++++++++++++++++++++++++----- io_uring/io_uring.h | 2 ++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 9e2b8d4c05db..4ba5292137c3 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -2322,7 +2322,7 @@ static int io_wake_function(struct wait_queue_entry *curr, unsigned int mode, * Cannot safely flush overflowed CQEs from here, ensure we wake up * the task, and the next invocation will do it. */ - if (io_should_wake(iowq) || io_has_work(iowq->ctx)) + if (io_should_wake(iowq) || io_has_work(iowq->ctx) || iowq->hit_timeout)
Shouldn't be needed. If the timer fires, it should wake the task, and the task will check ->hit_timeout there and later remove the itself from the waitqueue.
return autoremove_wake_function(curr, mode, wake_flags, key); return -1; } @@ -2350,6 +2350,34 @@ static bool current_pending_io(void) return percpu_counter_read_positive(&tctx->inflight); }
... -- Pavel Begunkov