Commit d74c0e6b authored by Geliang Tang's avatar Geliang Tang Committed by Paolo Bonzini

KVM: x86: use list_last_entry

To make the intention clearer, use list_last_entry instead of
list_entry.
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 652fc08d
...@@ -2354,8 +2354,8 @@ static bool prepare_zap_oldest_mmu_page(struct kvm *kvm, ...@@ -2354,8 +2354,8 @@ static bool prepare_zap_oldest_mmu_page(struct kvm *kvm,
if (list_empty(&kvm->arch.active_mmu_pages)) if (list_empty(&kvm->arch.active_mmu_pages))
return false; return false;
sp = list_entry(kvm->arch.active_mmu_pages.prev, sp = list_last_entry(&kvm->arch.active_mmu_pages,
struct kvm_mmu_page, link); struct kvm_mmu_page, link);
kvm_mmu_prepare_zap_page(kvm, sp, invalid_list); kvm_mmu_prepare_zap_page(kvm, sp, invalid_list);
return true; return true;
......
...@@ -6445,8 +6445,8 @@ static struct loaded_vmcs *nested_get_current_vmcs02(struct vcpu_vmx *vmx) ...@@ -6445,8 +6445,8 @@ static struct loaded_vmcs *nested_get_current_vmcs02(struct vcpu_vmx *vmx)
if (vmx->nested.vmcs02_num >= max(VMCS02_POOL_SIZE, 1)) { if (vmx->nested.vmcs02_num >= max(VMCS02_POOL_SIZE, 1)) {
/* Recycle the least recently used VMCS. */ /* Recycle the least recently used VMCS. */
item = list_entry(vmx->nested.vmcs02_pool.prev, item = list_last_entry(&vmx->nested.vmcs02_pool,
struct vmcs02_list, list); struct vmcs02_list, list);
item->vmptr = vmx->nested.current_vmptr; item->vmptr = vmx->nested.current_vmptr;
list_move(&item->list, &vmx->nested.vmcs02_pool); list_move(&item->list, &vmx->nested.vmcs02_pool);
return &item->vmcs02; return &item->vmcs02;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment