[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 17/50] memory: optimize memory_region_sync_dirty_bitm
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 17/50] memory: optimize memory_region_sync_dirty_bitmap |
Date: |
Mon, 24 Oct 2016 15:47:02 +0200 |
Avoid walking the FlatView of all address spaces. Most of the
address spaces will have no log_sync callback on their listeners.
Signed-off-by: Paolo Bonzini <address@hidden>
---
memory.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/memory.c b/memory.c
index c857722..edbc701 100644
--- a/memory.c
+++ b/memory.c
@@ -1642,14 +1642,26 @@ bool memory_region_test_and_clear_dirty(MemoryRegion
*mr, hwaddr addr,
void memory_region_sync_dirty_bitmap(MemoryRegion *mr)
{
+ MemoryListener *listener;
AddressSpace *as;
+ FlatView *view;
FlatRange *fr;
- QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
- FlatView *view = address_space_get_flatview(as);
+ /* If the same address space has multiple log_sync listeners, we
+ * visit that address space's FlatView multiple times. But because
+ * log_sync listeners are rare, it's still cheaper than walking each
+ * address space once.
+ */
+ QTAILQ_FOREACH(listener, &memory_listeners, link) {
+ if (!listener->log_sync) {
+ continue;
+ }
+ as = listener->address_space;
+ view = address_space_get_flatview(as);
FOR_EACH_FLAT_RANGE(fr, view) {
if (fr->mr == mr) {
- MEMORY_LISTENER_UPDATE_REGION(fr, as, Forward, log_sync);
+ MemoryRegionSection mrs = section_from_flat_range(fr, as);
+ listener->log_sync(listener, &mrs);
}
}
flatview_unref(view);
--
1.8.3.1
- [Qemu-devel] [PULL 03/50] block/iscsi: Introducing new zero-copy API, (continued)
- [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, 2016/10/24
- [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 <=
- [Qemu-devel] [PULL 15/50] memory: add a per-AddressSpace list of listeners, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 20/50] rng: remove unused included header, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 16/50] memory: optimize memory_global_dirty_log_sync, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 19/50] char.h: misc doc fix, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 21/50] char: remove use-after-free on win-stdio, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 18/50] char: serial: check divider value against baud base, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 22/50] ringbuf: fix chr_write return value, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 23/50] sun4uv: fix serial initialization regression, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 28/50] char: introduce CharBackend, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 24/50] malta: replace chr init by CHR_EVENT_OPENED handler, Paolo Bonzini, 2016/10/24