Commit 35d90f9
committed
io_uring: include task_work run after scheduling in wait for events
It's quite possible that we got woken up because task_work was queued,
and we need to process this task_work to generate the events waited for.
If we return to the wait loop without running task_work, we'll end up
adding the task to the waitqueue again, only to call
io_cqring_wait_schedule() again which will run the task_work. This is
less efficient than it could be, as it requires adding to the cq_wait
queue again. It also triggers the wakeup path for completions as
cq_wait is now non-empty with the task itself, and it'll require another
lock grab and deletion to remove ourselves from the waitqueue.
Signed-off-by: Jens Axboe <[email protected]>1 parent 6434ec0 commit 35d90f9
1 file changed
+10
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2481 | 2481 | | |
2482 | 2482 | | |
2483 | 2483 | | |
2484 | | - | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
2485 | 2492 | | |
2486 | 2493 | | |
2487 | 2494 | | |
| |||
2546 | 2553 | | |
2547 | 2554 | | |
2548 | 2555 | | |
| 2556 | + | |
| 2557 | + | |
2549 | 2558 | | |
2550 | 2559 | | |
2551 | 2560 | | |
| |||
0 commit comments