From: Hao Xu Date: Tue, 10 Aug 2021 12:55:54 +0000 (+0800) Subject: io-wq: move nr_running and worker_refs out of wqe->lock protection X-Git-Tag: v5.15~354^2~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=79dca1846fe979304ad0b998e56b20326e2e5a72;p=platform%2Fkernel%2Flinux-starfive.git 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 Link: https://lore.kernel.org/r/20210810125554.99229-1-haoxu@linux.alibaba.com Signed-off-by: Jens Axboe --- diff --git a/fs/io-wq.c b/fs/io-wq.c index 4ce83bb..8da9bb1 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); + } } }