Skip to content

Commit 081b582

Browse files
committed
io-wq: make io_worker lock a raw spinlock
In preparation to nesting it under the wqe lock (which is raw due to being acquired from the scheduler side), change the io_worker lock from a normal spinlock to a raw spinlock. Signed-off-by: Jens Axboe <[email protected]>
1 parent ea6e7ce commit 081b582

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

fs/io-wq.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct io_worker {
4848
struct io_wqe *wqe;
4949

5050
struct io_wq_work *cur_work;
51-
spinlock_t lock;
51+
raw_spinlock_t lock;
5252

5353
struct completion ref_done;
5454

@@ -528,9 +528,9 @@ static void io_assign_current_work(struct io_worker *worker,
528528
cond_resched();
529529
}
530530

531-
spin_lock(&worker->lock);
531+
raw_spin_lock(&worker->lock);
532532
worker->cur_work = work;
533-
spin_unlock(&worker->lock);
533+
raw_spin_unlock(&worker->lock);
534534
}
535535

536536
static void io_wqe_enqueue(struct io_wqe *wqe, struct io_wq_work *work);
@@ -814,7 +814,7 @@ static bool create_io_worker(struct io_wq *wq, struct io_wqe *wqe, int index)
814814

815815
refcount_set(&worker->ref, 1);
816816
worker->wqe = wqe;
817-
spin_lock_init(&worker->lock);
817+
raw_spin_lock_init(&worker->lock);
818818
init_completion(&worker->ref_done);
819819

820820
if (index == IO_WQ_ACCT_BOUND)
@@ -980,13 +980,13 @@ static bool io_wq_worker_cancel(struct io_worker *worker, void *data)
980980
* Hold the lock to avoid ->cur_work going out of scope, caller
981981
* may dereference the passed in work.
982982
*/
983-
spin_lock(&worker->lock);
983+
raw_spin_lock(&worker->lock);
984984
if (worker->cur_work &&
985985
match->fn(worker->cur_work, match->data)) {
986986
set_notify_signal(worker->task);
987987
match->nr_running++;
988988
}
989-
spin_unlock(&worker->lock);
989+
raw_spin_unlock(&worker->lock);
990990

991991
return match->nr_running && !match->cancel_all;
992992
}

0 commit comments

Comments
 (0)