Re: [PATCH 5/5] kvm: optimize GFN to memslot lookup with large slots amount

2014-12-02 Thread Radim Krčmář
2014-12-02 19:45+0100, Paolo Bonzini: > On 02/12/2014 18:33, Radim Krčmář wrote: > >> > +while (start < end) { > >> > +slot = start + (end - start) / 2; > >> > + > >> > +if (gfn >= memslots[slot].base_gfn) > > (Even thought division is costly, I think that ch

Re: [PATCH 5/5] kvm: optimize GFN to memslot lookup with large slots amount

2014-12-02 Thread Paolo Bonzini
On 02/12/2014 18:33, Radim Krčmář wrote: >> > + while (start < end) { >> > + slot = start + (end - start) / 2; >> > + >> > + if (gfn >= memslots[slot].base_gfn) > (Even thought division is costly, I think that checking here if 'slot' > is the one we want wouldn't help very muc

Re: [PATCH 5/5] kvm: optimize GFN to memslot lookup with large slots amount

2014-12-02 Thread Radim Krčmář
2014-12-01 17:29+, Igor Mammedov: > Current linear search doesn't scale well when > large amount of memslots is used and looked up slot > is not in the beginning memslots array. > Taking in account that memslots don't overlap, it's > possible to switch sorting order of memslots array from > 'np

[PATCH 5/5] kvm: optimize GFN to memslot lookup with large slots amount

2014-12-01 Thread Igor Mammedov
Current linear search doesn't scale well when large amount of memslots is used and looked up slot is not in the beginning memslots array. Taking in account that memslots don't overlap, it's possible to switch sorting order of memslots array from 'npages' to 'base_gfn' and use binary search for mems