Skip to content

Commit ca41c34

Browse files
sean-jcbonzini
authored andcommitted
KVM: x86/mmu: Relocate kvm_mmu_page.tdp_mmu_page for better cache locality
Move "tdp_mmu_page" into the 1-byte void left by the recently removed "mmio_cached" so that it resides in the first 64 bytes of kvm_mmu_page, i.e. in the same cache line as the most commonly accessed fields. Don't bother wrapping tdp_mmu_page in CONFIG_X86_64, including the field in 32-bit builds doesn't affect the size of kvm_mmu_page, and a future patch can always wrap the field in the unlikely event KVM gains a 1-byte flag that is 32-bit specific. Note, the size of kvm_mmu_page is also unchanged on CONFIG_X86_64=y due to it previously sharing an 8-byte chunk with write_flooding_count. No functional change intended. Signed-off-by: Sean Christopherson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent e717733 commit ca41c34

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/x86/kvm/mmu/mmu_internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct kvm_mmu_page {
3535
struct hlist_node hash_link;
3636
struct list_head lpage_disallowed_link;
3737

38+
bool tdp_mmu_page;
3839
bool unsync;
3940
u8 mmu_valid_gen;
4041
bool lpage_disallowed; /* Can't be replaced by an equiv large page */
@@ -70,8 +71,6 @@ struct kvm_mmu_page {
7071
atomic_t write_flooding_count;
7172

7273
#ifdef CONFIG_X86_64
73-
bool tdp_mmu_page;
74-
7574
/* Used for freeing the page asynchronously if it is a TDP MMU page. */
7675
struct rcu_head rcu_head;
7776
#endif

0 commit comments

Comments
 (0)