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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 < (KVM_MEM_SLOTS_NUM - 1) &&
> > 		       new->npages < mslots[i + 1].npages) {
> > 			mslots[i] = mslots[i + 1];
> > 			slots->id_to_index[mslots[i].id] = i;
> > 			i++;
> > 		}
> > 	else if (new->npages > mslots[i].npages)
> > 		while (i > 0 &&
> > 		       new->npages > mslots[i - 1].npages) {
> > 			mslots[i] = mslots[i - 1];
> > 			slots->id_to_index[mslots[i].id] = i;
> > 			i--;
> > 		}
> > 
> > (I guess you don't want me to abstract these two loops further :)
> 
> Right.  You do not need the "else if" as long as you keep the outer "if
> (new->npages != mslots[i].npages)".

True, I'm just an indentation hater.

> > (We'll have to change it into an interval tree, or something, if the
> >  number of slots rises anyway.)
> 
> I don't think that's needed, actually.  gfn_to_page and gfn_to_memslot
> are very rarely in the profiles with EPT.

Ah, that replaces my reply to Igor, thanks.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux