diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-12-21 00:31:36 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-01-16 17:52:35 +0100 |
commit | 0987d735a3a42c92f6e7e0caa8bab1b0139e3b54 (patch) | |
tree | 82eee4bc187b2e03305b67b89c0476142d88431b /exec.c | |
parent | fb5e19d2e1472e96d72d5e4d89c20033f8ab345c (diff) |
ramblock-notifier: new
This adds a notify interface of ram block additions and removals.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1687,6 +1687,7 @@ static void ram_block_add(RAMBlock *new_block, Error **errp) qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE); /* MADV_DONTFORK is also needed by KVM in absence of synchronous MMU */ qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK); + ram_block_notify_add(new_block->host, new_block->max_length); } } @@ -1817,6 +1818,10 @@ void qemu_ram_free(RAMBlock *block) return; } + if (block->host) { + ram_block_notify_remove(block->host, block->max_length); + } + qemu_mutex_lock_ramlist(); QLIST_REMOVE_RCU(block, next); ram_list.mru_block = NULL; |