[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/50] rcu: simplify memory barriers
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 08/50] rcu: simplify memory barriers |
Date: |
Mon, 24 Oct 2016 15:46:53 +0200 |
Thanks to the acquire semantics of qemu_event_reset and qemu_event_wait,
some memory barriers can be removed.
Signed-off-by: Paolo Bonzini <address@hidden>
---
util/rcu.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/util/rcu.c b/util/rcu.c
index bceb3e4..9adc5e4 100644
--- a/util/rcu.c
+++ b/util/rcu.c
@@ -82,14 +82,16 @@ static void wait_for_readers(void)
/* Instead of using atomic_mb_set for index->waiting, and
* atomic_mb_read for index->ctr, memory barriers are placed
* manually since writes to different threads are independent.
- * atomic_mb_set has a smp_wmb before...
+ * qemu_event_reset has acquire semantics, so no memory barrier
+ * is needed here.
*/
- smp_wmb();
QLIST_FOREACH(index, ®istry, node) {
atomic_set(&index->waiting, true);
}
- /* ... and a smp_mb after. */
+ /* Here, order the stores to index->waiting before the
+ * loads of index->ctr.
+ */
smp_mb();
QLIST_FOREACH_SAFE(index, ®istry, node, tmp) {
@@ -104,9 +106,6 @@ static void wait_for_readers(void)
}
}
- /* atomic_mb_read has smp_rmb after. */
- smp_rmb();
-
if (QLIST_EMPTY(®istry)) {
break;
}
--
1.8.3.1
- [Qemu-devel] [PULL 00/50] Miscellaneous patches for 2016-10-24, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 01/50] kvm-all: don't use stale dbg_data->cpu, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 02/50] rbd: shift byte count as a 64-bit value, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 05/50] Put the copyright information on a separate line, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 07/50] qemu-thread: use acquire/release to clarify semantics of QemuEvent, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 03/50] block/iscsi: Introducing new zero-copy API, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 08/50] rcu: simplify memory barriers,
Paolo Bonzini <=
- [Qemu-devel] [PULL 04/50] block/iscsi: Adding new iSER transport layer option, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 06/50] atomic: introduce smp_mb_acquire and smp_mb_release, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 12/50] target-i386: fix 32-bit addresses in LEA, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 11/50] test-i386: fix bitrot for 64-bit, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 09/50] atomic: base mb_read/mb_set on load-acquire and store-release, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 10/50] qht-bench: relax test_start/stop atomic accesses, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 13/50] tcg: try sti when moving a constant into a dead memory temp, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 14/50] memory: eliminate global MemoryListeners, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 17/50] memory: optimize memory_region_sync_dirty_bitmap, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 15/50] memory: add a per-AddressSpace list of listeners, Paolo Bonzini, 2016/10/24