public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: yalin wang <yalin.wang2010@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [RFC] block: change to use atomic_inc_return_release()
Date: Mon, 16 Nov 2015 20:38:36 -0700	[thread overview]
Message-ID: <564AA13C.108@kernel.dk> (raw)
In-Reply-To: <1447730650-23030-1-git-send-email-yalin.wang2010@gmail.com>

On 11/16/2015 08:24 PM, yalin wang wrote:
> Some arch define this atomic_inc_return_release() OP.

That is a very vague commit message, you'll need a whole lot more than 
that... A commit message is supposed to describe the reason for the 
change. You provide no reason for the change.

> diff --git a/block/bio.c b/block/bio.c
> index fbc558b..b251857 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -310,8 +310,7 @@ static void bio_chain_endio(struct bio *bio, int error)
>   static inline void bio_inc_remaining(struct bio *bio)
>   {
>   	bio->bi_flags |= (1 << BIO_CHAIN);
> -	smp_mb__before_atomic();
> -	atomic_inc(&bio->__bi_remaining);
> +	atomic_inc_return_release(&bio->__bi_remaining);

Are these equivalent? Where's the documentation for this primitive? The 
previous code ensured that we ordered the dec of the remaining count 
with the update of the flags.

-- 
Jens Axboe


  reply	other threads:[~2015-11-17  3:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17  3:24 [RFC] block: change to use atomic_inc_return_release() yalin wang
2015-11-17  3:38 ` Jens Axboe [this message]
2015-11-17  4:11   ` yalin wang

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=564AA13C.108@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yalin.wang2010@gmail.com \
    /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