[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] aio: Remove spurious smp_read_barrier_depends()
From: |
Pranith Kumar |
Subject: |
[Qemu-devel] [PATCH] aio: Remove spurious smp_read_barrier_depends() |
Date: |
Wed, 31 Aug 2016 18:29:09 -0400 |
smp_read_barrier_depends() should be used only if you are reading
dependent pointers which are shared. Here 'bh' is a local variable and
dereferencing it will always be ordered after loading 'bh', i.e.,
bh->next will always be ordered after fetching bh.
This patch removes the barrier and adds a comment why storing
'bh->next' is necessary.
Signed-off-by: Pranith Kumar <address@hidden>
---
async.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/async.c b/async.c
index 3bca9b0..6b691aa 100644
--- a/async.c
+++ b/async.c
@@ -77,8 +77,7 @@ int aio_bh_poll(AioContext *ctx)
ret = 0;
for (bh = ctx->first_bh; bh; bh = next) {
- /* Make sure that fetching bh happens before accessing its members */
- smp_read_barrier_depends();
+ /* store bh->next since bh can be freed in aio_bh_call() */
next = bh->next;
/* The atomic_xchg is paired with the one in qemu_bh_schedule. The
* implicit memory barrier ensures that the callback sees all writes
--
2.9.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH] aio: Remove spurious smp_read_barrier_depends(),
Pranith Kumar <=