public inbox for [email protected]
 help / color / mirror / Atom feed
From: Hao Xu <[email protected]>
To: Jens Axboe <[email protected]>
Cc: [email protected], Pavel Begunkov <[email protected]>,
	Joseph Qi <[email protected]>
Subject: Re: [PATCH for-5.15] io-wq: move nr_running and worker_refs out of wqe->lock protection
Date: Wed, 18 Aug 2021 17:22:37 +0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

在 2021/8/10 下午8:55, Hao Xu 写道:
ping
> 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 <[email protected]>
> ---
>   fs/io-wq.c | 7 ++++---
>   1 file 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);
> +		}
>   	}
>   }
>   
> 


  reply	other threads:[~2021-08-18  9:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10 12:55 [PATCH for-5.15] io-wq: move nr_running and worker_refs out of wqe->lock protection Hao Xu
2021-08-18  9:22 ` Hao Xu [this message]
2021-08-18 13:27 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f2db1235-1939-f8de-40f3-a3433bf9f805@linux.alibaba.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox