[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 28/29] memory: make cpu_physical_memory_sync_dirt
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH v3 28/29] memory: make cpu_physical_memory_sync_dirty_bitmap() fully atomic |
Date: |
Tue, 26 May 2015 18:55:04 +0200 |
From: Stefan Hajnoczi <address@hidden>
The fast path of cpu_physical_memory_sync_dirty_bitmap() directly
manipulates the dirty bitmap. Use atomic_xchg() to make the
test-and-clear atomic.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Message-Id: <address@hidden>
[Only do xchg on nonzero words. - Paolo]
Reviewed-by: Fam Zheng <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
include/exec/ram_addr.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index e93207d..ffd7710 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -224,12 +224,12 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(unsigned
long *dest,
for (k = page; k < page + nr; k++) {
if (src[k]) {
+ unsigned long bits = atomic_xchg(&src[k], 0);
unsigned long new_dirty;
new_dirty = ~dest[k];
- dest[k] |= src[k];
- new_dirty &= src[k];
+ dest[k] |= bits;
+ new_dirty &= bits;
num_dirty += ctpopl(new_dirty);
- src[k] = 0;
}
}
} else {
--
1.8.3.1
- Re: [Qemu-devel] [PATCH v3 14/29] exec: use memory_region_get_dirty_log_mask to optimize dirty tracking, (continued)
- [Qemu-devel] [PATCH v3 25/29] memory: use atomic ops for setting dirty memory bits, Paolo Bonzini, 2015/05/26
- [Qemu-devel] [PATCH v3 06/29] memory: prepare for multiple bits in the dirty log mask, Paolo Bonzini, 2015/05/26
- [Qemu-devel] [PATCH v3 17/29] cputlb: remove useless arguments to tlb_unprotect_code_phys, rename, Paolo Bonzini, 2015/05/26
- [Qemu-devel] [PATCH v3 26/29] migration: move dirty bitmap sync to ram_addr.h, Paolo Bonzini, 2015/05/26
- [Qemu-devel] [PATCH v3 12/29] kvm: remove special handling of DIRTY_MEMORY_MIGRATION in the dirty log mask, Paolo Bonzini, 2015/05/26
- [Qemu-devel] [PATCH v3 08/29] ui/console: remove dpy_gfx_update_dirty, Paolo Bonzini, 2015/05/26
- [Qemu-devel] [PATCH v3 27/29] memory: replace cpu_physical_memory_reset_dirty() with test-and-clear, Paolo Bonzini, 2015/05/26
- [Qemu-devel] [PATCH v3 28/29] memory: make cpu_physical_memory_sync_dirty_bitmap() fully atomic,
Paolo Bonzini <=
- [Qemu-devel] [PATCH v3 29/29] memory: use mr->ram_addr in "is this RAM?" assertions, Paolo Bonzini, 2015/05/26
- Re: [Qemu-devel] [PATCH v3 00/29] Dirty bitmap atomic access and optimizations, Aurelien Jarno, 2015/05/26