Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 506d95f

Browse files
committed
io-wq: remove worker->wait waitqueue
We only have one cases of using the waitqueue to wake the worker, the rest are using wake_up_process(). Since we can save some cycles not fiddling with the waitqueue io_wqe_worker(), switch the work activation to task wakeup and get rid of the now unused wait_queue_head_t in struct io_worker. Signed-off-by: Jens Axboe <[email protected]>
1 parent 4e88d6e commit 506d95f

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

fs/io-wq.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ struct io_worker {
4949
struct hlist_nulls_node nulls_node;
5050
struct list_head all_list;
5151
struct task_struct *task;
52-
wait_queue_head_t wait;
5352
struct io_wqe *wqe;
5453

5554
struct io_wq_work *cur_work;
@@ -258,7 +257,7 @@ static bool io_wqe_activate_free_worker(struct io_wqe *wqe)
258257

259258
worker = hlist_nulls_entry(n, struct io_worker, nulls_node);
260259
if (io_worker_get(worker)) {
261-
wake_up(&worker->wait);
260+
wake_up_process(worker->task);
262261
io_worker_release(worker);
263262
return true;
264263
}
@@ -497,13 +496,11 @@ static int io_wqe_worker(void *data)
497496
struct io_worker *worker = data;
498497
struct io_wqe *wqe = worker->wqe;
499498
struct io_wq *wq = wqe->wq;
500-
DEFINE_WAIT(wait);
501499

502500
io_worker_start(wqe, worker);
503501

504502
while (!test_bit(IO_WQ_BIT_EXIT, &wq->state)) {
505-
prepare_to_wait(&worker->wait, &wait, TASK_INTERRUPTIBLE);
506-
503+
set_current_state(TASK_INTERRUPTIBLE);
507504
spin_lock_irq(&wqe->lock);
508505
if (io_wqe_run_queue(wqe)) {
509506
__set_current_state(TASK_RUNNING);
@@ -526,8 +523,6 @@ static int io_wqe_worker(void *data)
526523
break;
527524
}
528525

529-
finish_wait(&worker->wait, &wait);
530-
531526
if (test_bit(IO_WQ_BIT_EXIT, &wq->state)) {
532527
spin_lock_irq(&wqe->lock);
533528
if (!wq_list_empty(&wqe->work_list))
@@ -589,7 +584,6 @@ static bool create_io_worker(struct io_wq *wq, struct io_wqe *wqe, int index)
589584

590585
refcount_set(&worker->ref, 1);
591586
worker->nulls_node.pprev = NULL;
592-
init_waitqueue_head(&worker->wait);
593587
worker->wqe = wqe;
594588
spin_lock_init(&worker->lock);
595589

0 commit comments

Comments
 (0)