Skip to content

KVM: optimize memslots searching

Xiao Guangrong kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest6 patches 16 repliesIn review

Change log from the cover letter

- sort memslots base on its size and do the line search instead of binary search base on gfn, it is from Avi's idea.
- in order to reduce cache footprint, memslots are sorted in the array of kvm->memslots->memslots[] and introduce a table to map slot id to index in the array

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6KVM: introduce KVM_MEM_SLOTS_NUM macroarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.c include/linux/kvm_host.h +1 more+10 -50 replies
2/6KVM: introduce update_memslots functionarch/x86/kvm/x86.c include/linux/kvm_host.h virt/kvm/kvm_main.c+17 -80 replies
3/6KVM: introduce kvm_for_each_memslot macroarch/ia64/kvm/kvm-ia64.c arch/x86/kvm/mmu.c include/linux/kvm_host.h +2 more+20 -156 replies
4/6KVM: introduce id_to_memslot functionarch/ia64/kvm/kvm-ia64.c arch/powerpc/kvm/book3s.c arch/x86/kvm/vmx.c +3 more+25 -110 replies
5/6KVM: sort memslots by its size and use line searchinclude/linux/kvm_host.h virt/kvm/kvm_main.c+75 -293 replies
6/6KVM: introduce a table to map slot id to index in memslots arryinclude/linux/kvm_host.h virt/kvm/kvm_main.c+13 -72 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/6] KVM: optimize memslots searching

This is the more work base on my v1 patchset which is posted some months ago, it can be found at:
https://lkml.org/lkml/2011/2/22/68

Change log:
- sort memslots base on its size and do the line search instead of binary search base on gfn, it is from Avi's idea.
- in order to reduce cache footprint, memslots are sorted in the array of kvm->memslots->memslots[] and introduce a table to map slot id to index in the array

There is the performance result:

autotest for RHEL.6.1 setup/boot/reboot/shutdown(average):
ept=1: before: 449.5 after: 447.8
ept=0: before: 532.7 after: 529.8

kernbench(average):
ept=1: before: 127.94 after: 126.98
ept=0: before: 196.85 after: 189.66