public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Davidlohr Bueso <dave@gnu.org>
Cc: Avi Kivity <avi@redhat.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: Thu, 08 Mar 2012 16:47:27 +0100	[thread overview]
Message-ID: <4F58D48F.8050807@de.ibm.com> (raw)
In-Reply-To: <1331207154.28711.2.camel@offworld>

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.
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".


Christian


  reply	other threads:[~2012-03-08 15:47 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 [this message]
2012-03-08 21:27   ` Davidlohr Bueso
2012-03-12 12:12   ` Avi Kivity
2012-03-23 21:51     ` Davidlohr Bueso
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=4F58D48F.8050807@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=avi@redhat.com \
    --cc=dave@gnu.org \
    --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