aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDave Hansen <dave@linux.vnet.ibm.com>2008-08-11 10:01:49 -0700
committerAvi Kivity <avi@qumranet.com>2008-10-15 10:15:18 +0200
commit6ad18fba05228fb1d47cdbc0339fe8b3fca1ca26 (patch)
tree4b64607dad75aa55dd397784d469d03244f0dfe7 /include
parentb772ff362ec6b821c8a5227a3355e263f917bfad (diff)
KVM: Reduce stack usage in kvm_pv_mmu_op()
We're in a hot path. We can't use kmalloc() because it might impact performance. So, we just stick the buffer that we need into the kvm_vcpu_arch structure. This is used very often, so it is not really a waste. We also have to move the buffer structure's definition to the arch-specific x86 kvm header. Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'include')
-rw-r--r--include/asm-x86/kvm_host.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h
index 99dddfcecf6..9cb4b4dae5c 100644
--- a/include/asm-x86/kvm_host.h
+++ b/include/asm-x86/kvm_host.h
@@ -201,6 +201,13 @@ struct kvm_mmu_page {
};
};
+struct kvm_pv_mmu_op_buffer {
+ void *ptr;
+ unsigned len;
+ unsigned processed;
+ char buf[512] __aligned(sizeof(long));
+};
+
/*
* x86 supports 3 paging modes (4-level 64-bit, 3-level 64-bit, and 2-level
* 32-bit). The kvm_mmu structure abstracts the details of the current mmu
@@ -248,6 +255,9 @@ struct kvm_vcpu_arch {
bool tpr_access_reporting;
struct kvm_mmu mmu;
+ /* only needed in kvm_pv_mmu_op() path, but it's hot so
+ * put it here to avoid allocation */
+ struct kvm_pv_mmu_op_buffer mmu_op_buffer;
struct kvm_mmu_memory_cache mmu_pte_chain_cache;
struct kvm_mmu_memory_cache mmu_rmap_desc_cache;