lkml.org 
[lkml]   [2014]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/5] kvm: optimize GFN to memslot lookup with large slots amount
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 checking here if 'slot'
> > is the one we want wouldn't help very much.)
> >
>
> Division by an unsigned is just a right shift. Division by signed
> integer is a right shift + conditional move. We can change / 2 to
> explicit >> 1, or change start and end to unsigned, or both.

My bad, no respectable optimizer would miss that.


\
 
 \ /
  Last update: 2014-12-02 22:41    [W:0.496 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site