History

io_uring/poll: use IOU_F_TWQ_LAZY_WAKE for wakeups

With poll triggered retries, each event trigger will cause a task_work item to be added for processing. If the ring is setup with IORING_SETUP_DEFER_TASKRUN and a task is waiting on multiple events to complete, any task_work addition will wake the task for processing these items. This can cause more context switches than we would like, if the application is deliberately waiting on multiple items to increase efficiency. For example, if an application has receive multishot armed for sockets and wants to wait for N to complete within M usec of time, we should not be waking up and processing these items until we have all the events we asked for. By switching the poll trigger to lazy wake, we'll process them when they are all ready, in one swoop, rather than wake multiple times only to process one and then go back to sleep. At some point we probably want to look at just making the lazy wake the default, but for now, let's just selectively enable it where it makes sense.

Jens Axboe committed 3 years ago

Commit 6ce4a931 parent b3a4dbc1 file · +1 −1Browse files

Unified · Split

io_uring/poll.c+1−1
@@ -370,7 +370,7 @@ static void __io_poll_execute(struct io_kiocb *req, int mask) · 369 unmodified lines
370 req->io_task_work.func = io_poll_task_func;370 req->io_task_work.func = io_poll_task_func;
371 371
372 trace_io_uring_task_add(req, mask);372 trace_io_uring_task_add(req, mask);
373 io_req_task_work_add(req);373 __io_req_task_work_add(req, IOU_F_TWQ_LAZY_WAKE);
374}374}
375 375
376static inline void io_poll_execute(struct io_kiocb *req, int res)376static inline void io_poll_execute(struct io_kiocb *req, int res)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t