Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1270793 > unrolled thread
| Started by | yalin wang <yalin.wang2010@gmail.com> |
|---|---|
| First post | 2015-11-17 04:30 +0100 |
| Last post | 2015-11-17 05:20 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[RFC] block: change to use atomic_inc_return_release() yalin wang <yalin.wang2010@gmail.com> - 2015-11-17 04:30 +0100
Re: [RFC] block: change to use atomic_inc_return_release() Jens Axboe <axboe@kernel.dk> - 2015-11-17 04:40 +0100
Re: [RFC] block: change to use atomic_inc_return_release() yalin wang <yalin.wang2010@gmail.com> - 2015-11-17 05:20 +0100
| From | yalin wang <yalin.wang2010@gmail.com> |
|---|---|
| Date | 2015-11-17 04:30 +0100 |
| Subject | [RFC] block: change to use atomic_inc_return_release() |
| Message-ID | <qvF7Y-7UB-3@gated-at.bofh.it> |
Some arch define this atomic_inc_return_release() OP.
Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
---
block/bio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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);
}
/**
--
1.9.1
--
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/
[toc] | [next] | [standalone]
| From | Jens Axboe <axboe@kernel.dk> |
|---|---|
| Date | 2015-11-17 04:40 +0100 |
| Message-ID | <qvFhF-7YL-41@gated-at.bofh.it> |
| In reply to | #1270793 |
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/
[toc] | [prev] | [next] | [standalone]
| From | yalin wang <yalin.wang2010@gmail.com> |
|---|---|
| Date | 2015-11-17 05:20 +0100 |
| Message-ID | <qvFUl-8sw-5@gated-at.bofh.it> |
| In reply to | #1270812 |
> On Nov 17, 2015, at 11:38, Jens Axboe <axboe@kernel.dk> wrote:
>
> 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.
>
i just have a look at ARM64 implementation for this new atomic OP ,
but i don’t find doc in memory-barrier.txt . so i make this RFC for some response,
atomic_inc_return_release() should have store_release() class memory barriers .
in this example, smp_store_release() memory barrier is not enough ?
just make sure bi_flags update can been seen by other cores before update atomic counter.
atomic_inc_return_{release,acquire,relax} OP seems newly add to kernel .
But i don’t see much users in code .
Can it be used to replace lots of smp_mb__before_atomic() ?
Thanks
--
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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web