Home Home > GIT Browse > SLE12-SP4
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2019-10-16 13:16:11 +0200
committerJoerg Roedel <jroedel@suse.de>2019-10-16 13:16:20 +0200
commit22579f2e816041c4b7b3f554a75abc66cdd121bb (patch)
treef79d210f68182b71c4eee3bee873f1cc5d7c926e
parentbba99d4d014c17a21b81427df0a2feaed3a1dcec (diff)
KVM: x86: adjust kvm_mmu_page member to save 8 bytes
(bsc#1117665).
-rw-r--r--patches.suse/kvm-x86-adjust-kvm_mmu_page-member-to-save-8-bytes56
-rw-r--r--series.conf1
2 files changed, 57 insertions, 0 deletions
diff --git a/patches.suse/kvm-x86-adjust-kvm_mmu_page-member-to-save-8-bytes b/patches.suse/kvm-x86-adjust-kvm_mmu_page-member-to-save-8-bytes
new file mode 100644
index 0000000000..2fbfcb163b
--- /dev/null
+++ b/patches.suse/kvm-x86-adjust-kvm_mmu_page-member-to-save-8-bytes
@@ -0,0 +1,56 @@
+From: Wei Yang <richard.weiyang@gmail.com>
+Date: Thu, 6 Sep 2018 05:58:16 +0800
+Subject: KVM: x86: adjust kvm_mmu_page member to save 8 bytes
+Git-commit: 3ff519f29d98ecdc1961d825d105d68711093b6b
+Patch-mainline: v4.20-rc1
+References: bsc#1117665
+
+On a 64bits machine, struct is naturally aligned with 8 bytes. Since
+kvm_mmu_page member *unsync* and *role* are less then 4 bytes, we can
+rearrange the sequence to compace the struct.
+
+As the comment shows, *role* and *gfn* are used to key the shadow page. In
+order to keep the comment valid, this patch moves the *unsync* up and
+exchange the position of *role* and *gfn*.
+
+>From /proc/slabinfo, it shows the size of kvm_mmu_page is 8 bytes less and
+with one more object per slap after applying this patch.
+
+ # name <active_objs> <num_objs> <objsize> <objperslab>
+ kvm_mmu_page_header 0 0 168 24
+
+ kvm_mmu_page_header 0 0 160 25
+
+Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Acked-by: Joerg Roedel <jroedel@suse.de>
+---
+ arch/x86/include/asm/kvm_host.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
+index 1c09a0d1771f..576ff47a79c4 100644
+--- a/arch/x86/include/asm/kvm_host.h
++++ b/arch/x86/include/asm/kvm_host.h
+@@ -281,18 +281,18 @@ struct kvm_rmap_head {
+ struct kvm_mmu_page {
+ struct list_head link;
+ struct hlist_node hash_link;
++ bool unsync;
+
+ /*
+ * The following two entries are used to key the shadow page in the
+ * hash table.
+ */
+- gfn_t gfn;
+ union kvm_mmu_page_role role;
++ gfn_t gfn;
+
+ u64 *spt;
+ /* hold the gfn of each spte inside spt */
+ gfn_t *gfns;
+- bool unsync;
+ int root_count; /* Currently serving as active root */
+ unsigned int unsync_children;
+ struct kvm_rmap_head parent_ptes; /* rmap pointers to parent sptes */
+
diff --git a/series.conf b/series.conf
index 6d117c2c47..d268e6a26f 100644
--- a/series.conf
+++ b/series.conf
@@ -20280,6 +20280,7 @@
patches.suse/KVM-PPC-Remove-redundand-permission-bits-removal.patch
patches.suse/kvm-nvmx-clear-reserved-bits-of-db-exit-qualification
patches.suse/kvm-nvmx-restore-host-state-in-nested_vmx_vmexit-for-vmfail
+ patches.suse/kvm-x86-adjust-kvm_mmu_page-member-to-save-8-bytes
patches.suse/kvm-nvmx-always-reflect-nm-vm-exits-to-l1
patches.suse/kvm-nvmx-move-check_vmentry_postreqs-call-to-nested_vmx_enter_non_root_mode
patches.suse/KVM-arm64-Fix-caching-of-host-MDCR_EL2-value.patch