mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: Davidlohr Bueso <dave@stgolabs.net>, kent.overstreet@gmail.com
Cc: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org,
	Davidlohr Bueso <dbueso@suse.de>
Subject: Re: [PATCH] bcache: optimize barrier usage for Rmw atomic bitops
Date: Fri, 20 Mar 2020 23:24:45 +0800	[thread overview]
Message-ID: <877a5349-3133-404a-86ea-02309080a520@suse.de> (raw)
In-Reply-To: <20200129180802.24626-1-dave@stgolabs.net>

On 2020/1/30 2:08 上午, Davidlohr Bueso wrote:
> We can avoid the unnecessary barrier on non LL/SC architectures,
> such as x86. Instead, use the smp_mb__after_atomic().
> 

Hi Davidlohr,

> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>

Sorry for replying late. Indeed we don't need to worry about the extra
smp_mb() because the code patch gets called every 5 seconds by default,
which is very infrequent. But I like this more accurate patch, it is in
my testing already.

And by your inspiration, I also fix some other locations to use
smp_mb__before/after_atomic().

Thank you.

Coly Li

> ---
>  drivers/md/bcache/writeback.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
> index 4a40f9eadeaf..284ff10f480f 100644
> --- a/drivers/md/bcache/writeback.c
> +++ b/drivers/md/bcache/writeback.c
> @@ -183,7 +183,7 @@ static void update_writeback_rate(struct work_struct *work)
>  	 */
>  	set_bit(BCACHE_DEV_RATE_DW_RUNNING, &dc->disk.flags);
>  	/* paired with where BCACHE_DEV_RATE_DW_RUNNING is tested */
> -	smp_mb();
> +	smp_mb__after_atomic();
>  
>  	/*
>  	 * CACHE_SET_IO_DISABLE might be set via sysfs interface,
> @@ -193,7 +193,7 @@ static void update_writeback_rate(struct work_struct *work)
>  	    test_bit(CACHE_SET_IO_DISABLE, &c->flags)) {
>  		clear_bit(BCACHE_DEV_RATE_DW_RUNNING, &dc->disk.flags);
>  		/* paired with where BCACHE_DEV_RATE_DW_RUNNING is tested */
> -		smp_mb();
> +		smp_mb__after_atomic();
>  		return;
>  	}
>  
> @@ -229,7 +229,7 @@ static void update_writeback_rate(struct work_struct *work)
>  	 */
>  	clear_bit(BCACHE_DEV_RATE_DW_RUNNING, &dc->disk.flags);
>  	/* paired with where BCACHE_DEV_RATE_DW_RUNNING is tested */
> -	smp_mb();
> +	smp_mb__after_atomic();
>  }
>  
>  static unsigned int writeback_delay(struct cached_dev *dc,
> 


-- 

Coly Li

      reply	other threads:[~2020-03-20 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 18:08 Davidlohr Bueso
2020-03-20 15:24 ` Coly Li [this message]

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=877a5349-3133-404a-86ea-02309080a520@suse.de \
    --to=colyli@suse.de \
    --cc=dave@stgolabs.net \
    --cc=dbueso@suse.de \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®