public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Takuya Yoshikawa <takuya.yoshikawa@gmail.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: MMU: Make pte_list_desc fit cache lines well
Date: Sun, 08 Apr 2012 16:09:58 +0300	[thread overview]
Message-ID: <4F818E26.8000809@redhat.com> (raw)
In-Reply-To: <20120321234939.326822b0552d5c463acda22d@gmail.com>

On 03/21/2012 04:49 PM, Takuya Yoshikawa wrote:
> From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
>
> We have PTE_LIST_EXT + 1 pointers in this structure and these 40/20
> bytes do not fit cache lines well.  Furthermore, some allocators may
> use 64/32-byte objects for the pte_list_desc cache.
>
> This patch solves this problem by changing PTE_LIST_EXT from 4 to 3.
>
> For shadow paging, the new size is still large enough to hold both the
> kernel and process mappings for usual anonymous pages.  For file
> mappings, there may be a slight change in the cache usage.
>
> Note: with EPT/NPT we almost always have a single spte in each reverse
> mapping and we will not see any change by this.
>
> @@ -135,8 +135,6 @@ module_param(dbg, bool, 0644);
>  #define PT64_PERM_MASK (PT_PRESENT_MASK | PT_WRITABLE_MASK | PT_USER_MASK \
>  			| PT64_NX_MASK)
>  
> -#define PTE_LIST_EXT 4
> -
>  #define ACC_EXEC_MASK    1
>  #define ACC_WRITE_MASK   PT_WRITABLE_MASK
>  #define ACC_USER_MASK    PT_USER_MASK
> @@ -151,6 +149,9 @@ module_param(dbg, bool, 0644);
>  
>  #define SHADOW_PT_INDEX(addr, level) PT64_INDEX(addr, level)
>  
> +/* make pte_list_desc fit well in cache line */
> +#define PTE_LIST_EXT 3
> +
>  struct pte_list_desc {
>  	u64 *sptes[PTE_LIST_EXT];
>  	struct pte_list_desc *more;

We could go even further and have 4 pointers, and use bit 0 to decide
whether it's a next pointer or an sptep.

Not sure it's worth the extra complexity.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2012-04-08 13:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21 14:48 [PATCH 0/2] Improve iteration through sptes from rmap Takuya Yoshikawa
2012-03-21 14:49 ` [PATCH 1/2] KVM: MMU: Make pte_list_desc fit cache lines well Takuya Yoshikawa
2012-04-08 13:09   ` Avi Kivity [this message]
2012-04-08 14:50     ` Takuya Yoshikawa
2012-03-21 14:50 ` [PATCH 2/2] KVM: MMU: Improve iteration through sptes from rmap Takuya Yoshikawa
2012-04-04 12:34 ` [PATCH 0/2] " Takuya Yoshikawa
2012-04-08 13:08 ` 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=4F818E26.8000809@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=takuya.yoshikawa@gmail.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