Skip to content

Commit 24c3fc5

Browse files
krismanaxboe
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 068c27e commit 24c3fc5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

io_uring/io-wq.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ struct io_worker {
5151
struct io_wq *wq;
5252

5353
struct io_wq_work *cur_work;
54-
struct io_wq_work *next_work;
5554
raw_spinlock_t lock;
5655

5756
struct completion ref_done;
@@ -539,7 +538,6 @@ static void io_assign_current_work(struct io_worker *worker,
539538

540539
raw_spin_lock(&worker->lock);
541540
worker->cur_work = work;
542-
worker->next_work = NULL;
543541
raw_spin_unlock(&worker->lock);
544542
}
545543

@@ -573,7 +571,7 @@ static void io_worker_handle_work(struct io_wq_acct *acct,
573571
* current work item for this worker.
574572
*/
575573
raw_spin_lock(&worker->lock);
576-
worker->next_work = work;
574+
worker->cur_work = work;
577575
raw_spin_unlock(&worker->lock);
578576
}
579577

@@ -1008,8 +1006,7 @@ static bool io_wq_worker_cancel(struct io_worker *worker, void *data)
10081006
* may dereference the passed in work.
10091007
*/
10101008
raw_spin_lock(&worker->lock);
1011-
if (__io_wq_worker_cancel(worker, match, worker->cur_work) ||
1012-
__io_wq_worker_cancel(worker, match, worker->next_work))
1009+
if (__io_wq_worker_cancel(worker, match, worker->cur_work))
10131010
match->nr_running++;
10141011
raw_spin_unlock(&worker->lock);
10151012

0 commit comments

Comments
 (0)