diff options
author | Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp> | 2013-03-06 02:05:52 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2013-03-07 15:26:27 -0500 |
commit | 945315b9dbbe102bb3393a34ea4a10fb2a5ff303 (patch) | |
tree | c7536765ae4012070454dabd19b748bb86d96aa2 /arch/x86/kvm/mmu.c | |
parent | 1044b0303464788820984a5b01c0a81860dce749 (diff) |
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: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r-- | arch/x86/kvm/mmu.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 3e4822b449da..0f42645a063c 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2087,7 +2087,7 @@ static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp, | |||
2087 | static void kvm_mmu_commit_zap_page(struct kvm *kvm, | 2087 | static void kvm_mmu_commit_zap_page(struct kvm *kvm, |
2088 | struct list_head *invalid_list) | 2088 | struct list_head *invalid_list) |
2089 | { | 2089 | { |
2090 | struct kvm_mmu_page *sp; | 2090 | struct kvm_mmu_page *sp, *nsp; |
2091 | 2091 | ||
2092 | if (list_empty(invalid_list)) | 2092 | if (list_empty(invalid_list)) |
2093 | return; | 2093 | return; |
@@ -2104,11 +2104,10 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm, | |||
2104 | */ | 2104 | */ |
2105 | kvm_flush_remote_tlbs(kvm); | 2105 | kvm_flush_remote_tlbs(kvm); |
2106 | 2106 | ||
2107 | do { | 2107 | list_for_each_entry_safe(sp, nsp, invalid_list, link) { |
2108 | sp = list_first_entry(invalid_list, struct kvm_mmu_page, link); | ||
2109 | WARN_ON(!sp->role.invalid || sp->root_count); | 2108 | WARN_ON(!sp->role.invalid || sp->root_count); |
2110 | kvm_mmu_free_page(sp); | 2109 | kvm_mmu_free_page(sp); |
2111 | } while (!list_empty(invalid_list)); | 2110 | } |
2112 | } | 2111 | } |
2113 | 2112 | ||
2114 | /* | 2113 | /* |