There's a case for io_uring where we want to run the task_work on ring exit, but we can't easily do that as we don't know if the task_works has work, or if exit work has already been queued. Here's two prep patches that adds a task_work_pending() helper, and makes task_work_run() check it. Then we can remove these checks from the caller, and we can have io_uring check if we need to run work if it needs to on ring exit. -- Jens Axboe