KVM: MMU: cleanup mapping-level
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Tue, 5 Feb 2013 07:26:54 +0000 (15:26 +0800)
committerMarcelo Tosatti <mtosatti@redhat.com>
Thu, 7 Feb 2013 00:42:08 +0000 (22:42 -0200)
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>
arch/x86/kvm/mmu.c

index 2a8d99a1e034a6294a982746d4cab1c74947a3d3..5356d8d2d496078a7a227dcb9b595c481ec0016a 100644 (file)
@@ -832,8 +832,7 @@ static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn)
        if (host_level == PT_PAGE_TABLE_LEVEL)
                return host_level;
 
-       max_level = kvm_x86_ops->get_lpage_level() < host_level ?
-               kvm_x86_ops->get_lpage_level() : host_level;
+       max_level = min(kvm_x86_ops->get_lpage_level(), host_level);
 
        for (level = PT_DIRECTORY_LEVEL; level <= max_level; ++level)
                if (has_wrprotected_page(vcpu->kvm, large_gfn, level))