Skip to content

Commit 4b44295

Browse files
Anthony Yznagabonzini
authored andcommitted
KVM: x86: avoid unnecessary rmap walks when creating/moving slots
On large memory guests it has been observed that creating a memslot for a very large range can take noticeable amount of time. Investigation showed that the time is spent walking the rmaps to update existing sptes to remove write access or set/clear dirty bits to support dirty logging. These rmap walks are unnecessary when creating or moving a memslot. A newly created memslot will not have any existing mappings, and the existing mappings of a moved memslot will have been invalidated and flushed. Any mappings established once the new/moved memslot becomes visible will be set using the properties of the new slot. Signed-off-by: Anthony Yznaga <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 5688fed commit 4b44295

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/x86.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10242,7 +10242,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
1024210242
*
1024310243
* FIXME: const-ify all uses of struct kvm_memory_slot.
1024410244
*/
10245-
if (change != KVM_MR_DELETE)
10245+
if (change == KVM_MR_FLAGS_ONLY)
1024610246
kvm_mmu_slot_apply_flags(kvm, (struct kvm_memory_slot *) new);
1024710247

1024810248
/* Free the arrays associated with the old memslot. */

0 commit comments

Comments
 (0)