]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: use signal based task_work running
authorJens Axboe <axboe@kernel.dk>
Tue, 30 Jun 2020 18:39:05 +0000 (12:39 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 30 Jun 2020 18:39:05 +0000 (12:39 -0600)
commit4e752236926c45b6fad8636f9f45fe593cf3a788
treea31b7d4e964ada0b9b768d405507c699dfef91b4
parentb6f6100d2b8fc551fd89814aba592ad1a91c06c0
io_uring: use signal based task_work running

Since 5.7, we've been using task_work to trigger async running of
requests in the context of the original task. This generally works
great, but there's a case where if the task is currently blocked
in the kernel waiting on a condition to become true, it won't process
task_work. Even though the task is woken, it just checks whatever
condition it's waiting on, and goes back to sleep if it's still false.

This is a problem if that very condition only becomes true when that
task_work is run. An example of that is the task registering an eventfd
with io_uring, and it's now blocked waiting on an eventfd read. That
read could depend on a completion event, and that completion event
won't get trigged until task_work has been run.

Use the TWA_SIGNAL notification for task_work, so that we ensure that
the task always runs the work when queued.

Cc: stable@vger.kernel.org # v5.7
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c