diff options
author | Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> | 2013-02-05 02:26:54 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2013-02-06 19:42:08 -0500 |
commit | 55dd98c3a81e243447d5fbf496fa8b909ef3b7f6 (patch) | |
tree | 3751b699f2ab8de6cbcc51b79f3671d2a0f0e4ac /arch/x86/kvm/mmu.c | |
parent | caf6900f2d8aaebe404c976753f6813ccd31d95e (diff) |
KVM: MMU: cleanup mapping-level
Use min() to cleanup mapping_level
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r-- | arch/x86/kvm/mmu.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 2a8d99a1e034..5356d8d2d496 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -832,8 +832,7 @@ static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn) | |||
832 | if (host_level == PT_PAGE_TABLE_LEVEL) | 832 | if (host_level == PT_PAGE_TABLE_LEVEL) |
833 | return host_level; | 833 | return host_level; |
834 | 834 | ||
835 | max_level = kvm_x86_ops->get_lpage_level() < host_level ? | 835 | max_level = min(kvm_x86_ops->get_lpage_level(), host_level); |
836 | kvm_x86_ops->get_lpage_level() : host_level; | ||
837 | 836 | ||
838 | for (level = PT_DIRECTORY_LEVEL; level <= max_level; ++level) | 837 | for (level = PT_DIRECTORY_LEVEL; level <= max_level; ++level) |
839 | if (has_wrprotected_page(vcpu->kvm, large_gfn, level)) | 838 | if (has_wrprotected_page(vcpu->kvm, large_gfn, level)) |