summaryrefslogtreecommitdiffstats
path: root/io_uring/io_uring.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2022-09-03 17:52:01 +0200
committerJens Axboe <axboe@kernel.dk>2022-09-21 18:30:43 +0200
commitdac6a0eae793f53c62a0f83d9f5423293a7845c4 (patch)
tree35f95f765ca36d7c2f4abcfc82d3b6659410139a /io_uring/io_uring.h
parentio_uring: add local task_work run helper that is entered locked (diff)
downloadlinux-dac6a0eae793f53c62a0f83d9f5423293a7845c4.tar.xz
linux-dac6a0eae793f53c62a0f83d9f5423293a7845c4.zip
io_uring: ensure iopoll runs local task work as well
Combine the two checks we have for task_work running and whether or not we need to shuffle the mutex into one, so we unify how task_work is run in the iopoll loop. This helps ensure that local task_work is run when needed, and also optimizes that path to avoid a mutex shuffle if it's not needed. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/io_uring.h')
-rw-r--r--io_uring/io_uring.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index 0f90d1dfa42b..9d89425292b7 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -236,6 +236,12 @@ static inline int io_run_task_work(void)
return 0;
}
+static inline bool io_task_work_pending(struct io_ring_ctx *ctx)
+{
+ return test_thread_flag(TIF_NOTIFY_SIGNAL) ||
+ !wq_list_empty(&ctx->work_llist);
+}
+
static inline int io_run_task_work_ctx(struct io_ring_ctx *ctx)
{
int ret = 0;