Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753325AbbKQDim (ORCPT ); Mon, 16 Nov 2015 22:38:42 -0500 Received: from mail-ig0-f169.google.com ([209.85.213.169]:36179 "EHLO mail-ig0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543AbbKQDij (ORCPT ); Mon, 16 Nov 2015 22:38:39 -0500 Subject: Re: [RFC] block: change to use atomic_inc_return_release() To: yalin wang , linux-kernel@vger.kernel.org References: <1447730650-23030-1-git-send-email-yalin.wang2010@gmail.com> From: Jens Axboe Message-ID: <564AA13C.108@kernel.dk> Date: Mon, 16 Nov 2015 20:38:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1447730650-23030-1-git-send-email-yalin.wang2010@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1138 Lines: 31 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/