migration: drop MADVISE_DONT_NEED for incoming zero pages
PATCH 1/1 migration: drop MADVISE_DONT_NEED for incoming zero pages
The madvise for zeroed out pages was introduced when every transferred zero page was memset to zero and thus allocated. Since commit 211ea740 we check for zeroness of a target page before we memset it to zero. Additionally we memmap target memory so it is essentially zero initalized (except for e.g. option roms and bios which are loaded into target memory altough they shouldn't).
It was reported recently that this madvise causes a performance degradation in some situations. As the madvise should only be called rarely and if its called it is likely on a busy page (it was non-zero and changed to zero during migration) drop it completely.
--- arch_init.c | 8 -------- 1 file changed, 8 deletions(-)
arch_init.c +0 -8
@@ -850,14 +850,6 @@ void ram_handle_compressed(void *host, uint8_t ch, uint64_t size) {if (ch !=0 || !is_zero_range (host, size)) {memset (host, ch, size); -#ifndef _WIN32 -if (ch ==0 && (!kvm_enabled () ||kvm_has_sync_mmu ())) { - size = size & ~(getpagesize () -1 ); -if (size >0 ) { -qemu_madvise (host, size,QEMU_MADV_DONTNEED ); - } - } -#endif } }
Signature · 1 line
1.7.9.5
Il 07/10/2013 11:22, Peter Lieven ha scritto:
Quoted 28 lines
The madvise for zeroed out pages was introduced when every transferred zero page was memset to zero and thus allocated. Since commit
211ea740we check for zeroness of a target page before we memset it to zero. Additionally we memmap target memory so it is essentially zero initalized (except for e.g. option roms and bios which are loaded into target memory altough they shouldn't).It was reported recently that this madvise causes a performance degradation in some situations. As the madvise should only be called rarely and if its called it is likely on a busy page (it was non-zero and changed to zero during migration) drop it completely.
Signed-off-by Peter Lieven <[email protected]>Reported-By Zhang Haoyu <[email protected]>--- arch_init.c | 8 -------- 1 file changed, 8 deletions(-)arch_init.c +0
-1@@ -850,14 +850,6 @@ void ram_handle_compressed(void *host, uint8_t ch, uint64_t size) {if (ch !=0 || !is_zero_range (host, size)) {memset (host, ch, size); -#ifndef _WIN32
arch_init.c void ram_handle_compressed(void *host, uint8_t ch, uint64_t size) · line 855
Quoted 10 lines
arch_init.c +0
-7-if (ch ==0 && (!kvm_enabled () ||kvm_has_sync_mmu ())) { - size = size & ~(getpagesize () -1 ); -if (size >0 ) { -qemu_madvise (host, size,QEMU_MADV_DONTNEED ); - } - } -#endif } }
Am 07.10.2013 11:22, schrieb Peter Lieven:
Quoted 5 lines
The madvise for zeroed out pages was introduced when every transferred zero page was memset to zero and thus allocated. Since commit
211ea740we check for zeroness of a target page before we memset it to zero. Additionally we memmap target memory so it is essentially zero initalized (except for e.g. option roms and bios which are loaded
"initialized"
Quoted 1 line
into target memory altough they shouldn't).
"although"
Quoted 3 lines
It was reported recently that this madvise causes a performance degradation in some situations. As the madvise should only be called rarely and if its called
"it's"
Quoted 5 lines
it is likely on a busy page (it was non-zero and changed to zero during migration) drop it completely.
Signed-off-by Peter Lieven <[email protected]>Reported-By Zhang Haoyu <[email protected]>
Please case "Reported-by" and place above Sob.
Juan, will you be picking this one up or do we need a respin?
Cheers,
Andreas
Quoted 24 lines
--- arch_init.c | 8 -------- 1 file changed, 8 deletions(-)arch_init.c +0
-8@@ -850,14 +850,6 @@ void ram_handle_compressed(void *host, uint8_t ch, uint64_t size) {if (ch !=0 || !is_zero_range (host, size)) {memset (host, ch, size); -#ifndef _WIN32 -if (ch ==0 && (!kvm_enabled () ||kvm_has_sync_mmu ())) { - size = size & ~(getpagesize () -1 ); -if (size >0 ) { -qemu_madvise (host, size,QEMU_MADV_DONTNEED ); - } - } -#endif } }
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg