Commit 945315b9 authored by Takuya Yoshikawa's avatar Takuya Yoshikawa Committed by Marcelo Tosatti

KVM: MMU: Use list_for_each_entry_safe in kvm_mmu_commit_zap_page()

We are traversing the linked list, invalid_list, deleting each entry by
kvm_mmu_free_page().  _safe version is there for such a case.
Reviewed-by: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 1044b030
...@@ -2087,7 +2087,7 @@ static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp, ...@@ -2087,7 +2087,7 @@ static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp,
static void kvm_mmu_commit_zap_page(struct kvm *kvm, static void kvm_mmu_commit_zap_page(struct kvm *kvm,
struct list_head *invalid_list) struct list_head *invalid_list)
{ {
struct kvm_mmu_page *sp; struct kvm_mmu_page *sp, *nsp;
if (list_empty(invalid_list)) if (list_empty(invalid_list))
return; return;
...@@ -2104,11 +2104,10 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm, ...@@ -2104,11 +2104,10 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm,
*/ */
kvm_flush_remote_tlbs(kvm); kvm_flush_remote_tlbs(kvm);
do { list_for_each_entry_safe(sp, nsp, invalid_list, link) {
sp = list_first_entry(invalid_list, struct kvm_mmu_page, link);
WARN_ON(!sp->role.invalid || sp->root_count); WARN_ON(!sp->role.invalid || sp->root_count);
kvm_mmu_free_page(sp); kvm_mmu_free_page(sp);
} while (!list_empty(invalid_list)); }
} }
/* /*
......
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