io_uring: dedup io_run_task_work
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 21 Jun 2022 09:09:02 +0000 (10:09 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 25 Jul 2022 00:39:15 +0000 (18:39 -0600)
We have an identical copy of io_run_task_work() for io-wq called
io_flush_signals(), deduplicate them.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/a157a4df5fa217b8bd03c73494f2fd0e24e44fbc.1655802465.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/filetable.h
io_uring/io-wq.c

index 6b58aa48bc45d39667317b74a6443d912892a0fa..fb5a274c08ffcc0a3d26ed1247b0b49e500cfc74 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef IOU_FILE_TABLE_H
 #define IOU_FILE_TABLE_H
 
+#include <linux/file.h>
+
 struct io_ring_ctx;
 struct io_kiocb;
 
index 3e34dfbdf9466afa2d67f910f3b439993cdf4099..77df5b43bf5239cf81e461af689c649c542f718f 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "io-wq.h"
 #include "slist.h"
+#include "io_uring.h"
 
 #define WORKER_IDLE_TIMEOUT    (5 * HZ)
 
@@ -519,23 +520,11 @@ static struct io_wq_work *io_get_next_work(struct io_wqe_acct *acct,
        return NULL;
 }
 
-static bool io_flush_signals(void)
-{
-       if (unlikely(test_thread_flag(TIF_NOTIFY_SIGNAL))) {
-               __set_current_state(TASK_RUNNING);
-               clear_notify_signal();
-               if (task_work_pending(current))
-                       task_work_run();
-               return true;
-       }
-       return false;
-}
-
 static void io_assign_current_work(struct io_worker *worker,
                                   struct io_wq_work *work)
 {
        if (work) {
-               io_flush_signals();
+               io_run_task_work();
                cond_resched();
        }
 
@@ -655,7 +644,7 @@ static int io_wqe_worker(void *data)
                last_timeout = false;
                __io_worker_idle(wqe, worker);
                raw_spin_unlock(&wqe->lock);
-               if (io_flush_signals())
+               if (io_run_task_work())
                        continue;
                ret = schedule_timeout(WORKER_IDLE_TIMEOUT);
                if (signal_pending(current)) {