Re: [PATCH 3/3] KVM: MMU: Separate trivial NULL check out from rmap_get_next()

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

 



On Thu, 15 Mar 2012 15:46:31 +0200
Avi Kivity <avi@xxxxxxxxxx> wrote:

> You can look at what's happening by doing
> 
>   perf record -a -f
>   perf report
> 
> using the TUI, select 'annotate rmap_get_next'
> 
> You should see where the time is spent.
> 

Since the default sampling rate was not enough to get consistent numbers,
I raised the frequency to 50K/sec; so there was surely some overheads
during that sampling.

>From the result below, it seems to be the prologue and epilogue on which
we spent most of our time.

	Takuya

===
 Percent |	Source code & Disassembly of kvm.ko
------------------------------------------------
         :
         :
         :
         :	Disassembly of section .text:
         :
         :	0001d260 <rmap_get_next>:
         :	 * Must be used with a valid iterator: e.g. after rmap_get_first().
         :	 *
         :	 * Returns true if spte is found, false otherwise.
         :	 */
         :	static bool rmap_get_next(struct rmap_iterator *iter)
         :	{
    1.75 :	   1d260:       push   %ebp
   17.54 :	   1d261:       mov    %esp,%ebp
   12.28 :	   1d263:       push   %ebx
    7.02 :	   1d264:       call   1d265 <rmap_get_next+0x5>
         :	        if (iter->desc) {
    1.75 :	   1d269:       mov    0x4(%eax),%ecx
         :	 * Must be used with a valid iterator: e.g. after rmap_get_first().
         :	 *
         :	 * Returns true if spte is found, false otherwise.
         :	 */
         :	static bool rmap_get_next(struct rmap_iterator *iter)
         :	{
   22.81 :	   1d26c:       mov    %eax,%edx
         :	        if (iter->desc) {
    0.00 :	   1d26e:       test   %ecx,%ecx
    0.00 :	   1d270:       je     1d2b8 <rmap_get_next+0x58>
         :	                if (iter->pos < PTE_LIST_EXT - 1) {
    0.00 :	   1d272:       mov    0x8(%eax),%eax
    0.00 :	   1d275:       cmp    $0x5,%eax
    0.00 :	   1d278:       jg     1d298 <rmap_get_next+0x38>
         :	                        ++iter->pos;
    0.00 :	   1d27a:       add    $0x1,%eax
    0.00 :	   1d27d:       mov    %eax,0x8(%edx)
         :	                        iter->sptep = iter->desc->sptes[iter->pos];
    0.00 :	   1d280:       mov    (%ecx,%eax,4),%ebx
         :	                        if (iter->sptep)
         :	                                return true;
    0.00 :	   1d283:       mov    $0x1,%eax
         :	{
         :	        if (iter->desc) {
         :	                if (iter->pos < PTE_LIST_EXT - 1) {
         :	                        ++iter->pos;
         :	                        iter->sptep = iter->desc->sptes[iter->pos];
         :	                        if (iter->sptep)
    0.00 :	   1d288:       test   %ebx,%ebx
         :	static bool rmap_get_next(struct rmap_iterator *iter)
         :	{
         :	        if (iter->desc) {
         :	                if (iter->pos < PTE_LIST_EXT - 1) {
         :	                        ++iter->pos;
         :	                        iter->sptep = iter->desc->sptes[iter->pos];
    0.00 :	   1d28a:       mov    %ebx,(%edx)
         :	                        if (iter->sptep)
    0.00 :	   1d28c:       je     1d298 <rmap_get_next+0x38>
         :	                }
         :	        }
         :
         :	        iter->sptep = NULL;
         :	        return false;
         :	}
    0.00 :	   1d28e:       pop    %ebx
    0.00 :	   1d28f:       pop    %ebp
    0.00 :	   1d290:       ret    
    0.00 :	   1d291:       lea    0x0(%esi,%eiz,1),%esi
         :	                        iter->sptep = iter->desc->sptes[iter->pos];
         :	                        if (iter->sptep)
         :	                                return true;
         :	                }
         :
         :	                iter->desc = iter->desc->more;
    0.00 :	   1d298:       mov    0x1c(%ecx),%eax
         :
         :	                if (iter->desc) {
    0.00 :	   1d29b:       test   %eax,%eax
         :	                        iter->sptep = iter->desc->sptes[iter->pos];
         :	                        if (iter->sptep)
         :	                                return true;
         :	                }
         :
         :	                iter->desc = iter->desc->more;
    0.00 :	   1d29d:       mov    %eax,0x4(%edx)
         :
         :	                if (iter->desc) {
    0.00 :	   1d2a0:       je     1d2b8 <rmap_get_next+0x58>
         :	                        iter->pos = 0;
    0.00 :	   1d2a2:       movl   $0x0,0x8(%edx)
         :	                        iter->sptep = iter->desc->sptes[iter->pos];
    0.00 :	   1d2a9:       mov    (%eax),%eax
    0.00 :	   1d2ab:       mov    %eax,(%edx)
    0.00 :	   1d2ad:       mov    $0x1,%eax
         :	                }
         :	        }
         :
         :	        iter->sptep = NULL;
         :	        return false;
         :	}
    0.00 :	   1d2b2:       pop    %ebx
    0.00 :	   1d2b3:       pop    %ebp
    0.00 :	   1d2b4:       ret    
    0.00 :	   1d2b5:       lea    0x0(%esi),%esi
         :	                        /* desc->sptes[0] cannot be NULL */
         :	                        return true;
         :	                }
         :	        }
         :
         :	        iter->sptep = NULL;
    0.00 :	   1d2b8:       movl   $0x0,(%edx)
         :	        return false;
    1.75 :	   1d2be:       xor    %eax,%eax
         :	}
   12.28 :	   1d2c0:       pop    %ebx
   22.81 :	   1d2c1:       pop    %ebp
    0.00 :	   1d2c2:       ret    
--
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