summaryrefslogtreecommitdiff
path: root/io_uring/io-wq.c
diff options
context:
space:
mode:
authorGabriel Krisman Bertazi <krisman@suse.de>2024-04-16 05:10:54 +0300
committerJens Axboe <axboe@kernel.dk>2024-04-17 17:20:32 +0300
commit24c3fc5c75c5b9d471783b4a4958748243828613 (patch)
treeb5809806d2c09f9f7d8fd1ce05f6ef178539d652 /io_uring/io-wq.c
parent068c27e32e51e94e4a9eb30ae85f4097a3602980 (diff)
downloadlinux-24c3fc5c75c5b9d471783b4a4958748243828613.tar.xz
io-wq: Drop intermediate step between pending list and active work
next_work is only used to make the work visible for cancellation. Instead, we can just directly write to cur_work before dropping the acct_lock and avoid the extra hop. Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de> Link: https://lore.kernel.org/r/20240416021054.3940-3-krisman@suse.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/io-wq.c')
-rw-r--r--io_uring/io-wq.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c
index 318ed067dbf6..d7fc6f6d4477 100644
--- a/io_uring/io-wq.c
+++ b/io_uring/io-wq.c
@@ -51,7 +51,6 @@ struct io_worker {
struct io_wq *wq;
struct io_wq_work *cur_work;
- struct io_wq_work *next_work;
raw_spinlock_t lock;
struct completion ref_done;
@@ -539,7 +538,6 @@ static void io_assign_current_work(struct io_worker *worker,
raw_spin_lock(&worker->lock);
worker->cur_work = work;
- worker->next_work = NULL;
raw_spin_unlock(&worker->lock);
}
@@ -573,7 +571,7 @@ static void io_worker_handle_work(struct io_wq_acct *acct,
* current work item for this worker.
*/
raw_spin_lock(&worker->lock);
- worker->next_work = work;
+ worker->cur_work = work;
raw_spin_unlock(&worker->lock);
}
@@ -1008,8 +1006,7 @@ static bool io_wq_worker_cancel(struct io_worker *worker, void *data)
* may dereference the passed in work.
*/
raw_spin_lock(&worker->lock);
- if (__io_wq_worker_cancel(worker, match, worker->cur_work) ||
- __io_wq_worker_cancel(worker, match, worker->next_work))
+ if (__io_wq_worker_cancel(worker, match, worker->cur_work))
match->nr_running++;
raw_spin_unlock(&worker->lock);