public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@gnu.org>
To: Avi Kivity <avi@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
	Marcelo Tosatti <mtosatti@redhat.com>, KVM <kvm@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] KVM: x86: add paging gcc optimization
Date: Fri, 23 Mar 2012 22:51:53 +0100	[thread overview]
Message-ID: <1332539514.2580.0.camel@offbook> (raw)
In-Reply-To: <4F5DE84B.8050606@redhat.com>

On Mon, 2012-03-12 at 14:12 +0200, Avi Kivity wrote:
> On 03/08/2012 05:47 PM, Christian Borntraeger wrote:
> > On 08/03/12 12:45, Davidlohr Bueso wrote:
> > > From: Davidlohr Bueso <dave@gnu.org>
> > > 
> > > Since most guests will have paging enabled for memory management, add likely() optimization
> > > around CR0.PG checks.
> >
> > >  {
> > > -	return kvm_read_cr0_bits(vcpu, X86_CR0_PG);
> > > +	return likely(kvm_read_cr0_bits(vcpu, X86_CR0_PG));
> >
> >
> > IMHO likely/unlikely should be considered more as fast-path/slow-path and not as often/less often.
> 
> Agree.
> 
> > Is that the case here? This patch  might cause a mis-prediction for non-paging guests all 
> > the time. 
> >
> > Non-paging might be really irrelevant, so I am just making a point, since
> > likely/unlikely is mis-used too often especially for "most users do it that way".
> 
> In fact this is a classic example.  Almost no guests use real mode (the
> last guests to use real mode extensively was DOS; I think Win9x switches
> to real mode pretty often).  As it's a user-controlled setting, we're
> penalizing users who do things differently.
> 
> However the majority if is_paging() == true guests is so huge, and since
> non-paging guests don't really expect 2012 performance levels anyway
> (being so old) that I think in practice this is a good optimization here.

Avi, will you be taking this patch? I don't see it applied or for pull
in 3.4.

Thanks.



  reply	other threads:[~2012-03-24 11:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 11:45 [PATCH v2] KVM: x86: add paging gcc optimization Davidlohr Bueso
2012-03-08 15:47 ` Christian Borntraeger
2012-03-08 21:27   ` Davidlohr Bueso
2012-03-12 12:12   ` Avi Kivity
2012-03-23 21:51     ` Davidlohr Bueso [this message]
2012-03-28 16:36       ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1332539514.2580.0.camel@offbook \
    --to=dave@gnu.org \
    --cc=avi@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox