Commit 30868442a5590991266a34af3f0b728a4a0ee6d0

Authored by Anthony Liguori
1 parent b09ea7d5

Instead of writing a zero page, madvise it away

Otherwise, after migration, we end up with a much larger RSS size then we
ought to have.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 6 additions and 0 deletions
... ... @@ -3346,6 +3346,12 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
3346 3346  
3347 3347 if (flags & RAM_SAVE_FLAG_COMPRESS) {
3348 3348 uint8_t ch = qemu_get_byte(f);
  3349 +#if defined(__linux__)
  3350 + if (ch == 0 &&
  3351 + (!kvm_enabled() || kvm_has_sync_mmu())) {
  3352 + madvise(qemu_get_ram_ptr(addr), TARGET_PAGE_SIZE, MADV_DONTNEED);
  3353 + } else
  3354 +#endif
3349 3355 memset(qemu_get_ram_ptr(addr), ch, TARGET_PAGE_SIZE);
3350 3356 } else if (flags & RAM_SAVE_FLAG_PAGE)
3351 3357 qemu_get_buffer(f, qemu_get_ram_ptr(addr), TARGET_PAGE_SIZE);
... ...