mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 14:02:05 -06:00
memory: syncronize kvm bitmap using bitmaps operations
If bitmaps are aligned properly, use bitmap operations. If they are not, just use old bit at a time code. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
This commit is contained in:
parent
5ff7fb77b3
commit
ae2810c4bb
1 changed files with 36 additions and 18 deletions
|
@ -83,13 +83,30 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap,
|
||||||
ram_addr_t start,
|
ram_addr_t start,
|
||||||
ram_addr_t pages)
|
ram_addr_t pages)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned long i, j;
|
||||||
unsigned long page_number, c;
|
unsigned long page_number, c;
|
||||||
hwaddr addr;
|
hwaddr addr;
|
||||||
ram_addr_t ram_addr;
|
ram_addr_t ram_addr;
|
||||||
unsigned int len = (pages + HOST_LONG_BITS - 1) / HOST_LONG_BITS;
|
unsigned long len = (pages + HOST_LONG_BITS - 1) / HOST_LONG_BITS;
|
||||||
unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE;
|
unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE;
|
||||||
|
unsigned long page = BIT_WORD(start >> TARGET_PAGE_BITS);
|
||||||
|
|
||||||
|
/* start address is aligned at the start of a word? */
|
||||||
|
if (((page * BITS_PER_LONG) << TARGET_PAGE_BITS) == start) {
|
||||||
|
long k;
|
||||||
|
long nr = BITS_TO_LONGS(pages);
|
||||||
|
|
||||||
|
for (k = 0; k < nr; k++) {
|
||||||
|
if (bitmap[k]) {
|
||||||
|
unsigned long temp = leul_to_cpu(bitmap[k]);
|
||||||
|
|
||||||
|
ram_list.dirty_memory[DIRTY_MEMORY_MIGRATION][page + k] |= temp;
|
||||||
|
ram_list.dirty_memory[DIRTY_MEMORY_VGA][page + k] |= temp;
|
||||||
|
ram_list.dirty_memory[DIRTY_MEMORY_CODE][page + k] |= temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xen_modified_memory(start, pages);
|
||||||
|
} else {
|
||||||
/*
|
/*
|
||||||
* bitmap-traveling is faster than memory-traveling (for addr...)
|
* bitmap-traveling is faster than memory-traveling (for addr...)
|
||||||
* especially when most of the memory is not dirty.
|
* especially when most of the memory is not dirty.
|
||||||
|
@ -109,6 +126,7 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start,
|
static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start,
|
||||||
ram_addr_t length,
|
ram_addr_t length,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue