diff options
author | Hao Xu <haoxu@linux.alibaba.com> | 2021-08-10 20:55:54 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-08-23 13:10:43 -0600 |
commit | 79dca1846fe979304ad0b998e56b20326e2e5a72 (patch) | |
tree | feacca1b7a5b7a6d4a90e2aa9940736545e0c682 /fs/io-wq.c | |
parent | ec3c3d0f3a271b5c7422449262970e7eb98f2126 (diff) | |
download | linux-79dca1846fe979304ad0b998e56b20326e2e5a72.tar.bz2 |
io-wq: move nr_running and worker_refs out of wqe->lock protection
We don't need to protect nr_running and worker_refs by wqe->lock, so
narrow the range of raw_spin_lock_irq - raw_spin_unlock_irq
Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
Link: https://lore.kernel.org/r/20210810125554.99229-1-haoxu@linux.alibaba.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io-wq.c')
-rw-r--r-- | fs/io-wq.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/io-wq.c b/fs/io-wq.c index 4ce83bb48021..8da9bb103916 100644 --- a/fs/io-wq.c +++ b/fs/io-wq.c @@ -256,16 +256,17 @@ static void io_wqe_wake_worker(struct io_wqe *wqe, struct io_wqe_acct *acct) raw_spin_lock_irq(&wqe->lock); if (acct->nr_workers < acct->max_workers) { - atomic_inc(&acct->nr_running); - atomic_inc(&wqe->wq->worker_refs); if (!acct->nr_workers) first = true; acct->nr_workers++; do_create = true; } raw_spin_unlock_irq(&wqe->lock); - if (do_create) + if (do_create) { + atomic_inc(&acct->nr_running); + atomic_inc(&wqe->wq->worker_refs); create_io_worker(wqe->wq, wqe, acct->index, first); + } } } |