Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Radim Krčmář
2014-11-14 15:29+0100, Paolo Bonzini: > On 14/11/2014 14:35, Radim Krčmář wrote: > > We are replacing in a sorted array, so the the direction of our > > traversal doesn't change, (and we could lose one tab level here,) > > > > if (new->npages < mslots[i].npages) { > > while (i < (K

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Paolo Bonzini
On 14/11/2014 15:41, Radim Krčmář wrote: > Yes, your improvement is great and would work even for higher amounts. > > I meant that our lookup is currently pretty sad -- O(N) that is > presumably optimized by looking at the largest regions first. Yes, that's the optimization. > Maybe we would b

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Radim Krčmář
2014-11-14 15:17+0100, Igor Mammedov: > > (We'll have to change it into an interval tree, or something, if the > > number of slots rises anyway.) > Only if it rises to huge amount, I've played with proposed 512 memslots > and it takes ~1 cycles which is 5% of current heapsort overhead. > Takin

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Paolo Bonzini
On 14/11/2014 14:35, Radim Krčmář wrote: > We are replacing in a sorted array, so the the direction of our > traversal doesn't change, (and we could lose one tab level here,) > > if (new->npages < mslots[i].npages) { > while (i < (KVM_MEM_SLOTS_NUM - 1) && >

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Igor Mammedov
On Fri, 14 Nov 2014 14:35:00 +0100 Radim Krčmář wrote: > 2014-11-14 12:12+0100, Paolo Bonzini: > > This completes the optimization from the previous patch, by > > removing the KVM_MEM_SLOTS_NUM-iteration loop from insert_memslot. > > > > Signed-off-by: Paolo Bonzini > > --- > > virt/kvm/kvm_ma

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Radim Krčmář
2014-11-14 12:12+0100, Paolo Bonzini: > This completes the optimization from the previous patch, by > removing the KVM_MEM_SLOTS_NUM-iteration loop from insert_memslot. > > Signed-off-by: Paolo Bonzini > --- > virt/kvm/kvm_main.c | 39 +++ > 1 file changed, 19

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Igor Mammedov
On Fri, 14 Nov 2014 12:12:00 +0100 Paolo Bonzini wrote: > This completes the optimization from the previous patch, by > removing the KVM_MEM_SLOTS_NUM-iteration loop from insert_memslot. > > Signed-off-by: Paolo Bonzini > --- > virt/kvm/kvm_main.c | 39 +++ >

[PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Paolo Bonzini
This completes the optimization from the previous patch, by removing the KVM_MEM_SLOTS_NUM-iteration loop from insert_memslot. Signed-off-by: Paolo Bonzini --- virt/kvm/kvm_main.c | 39 +++ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/virt/k