diff options
author | Avi Kivity <avi@qumranet.com> | 2007-03-26 13:31:52 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-05-03 03:52:27 -0400 |
commit | 36868f7b0efd0b6a1d45fe3b40a6c4bc63222659 (patch) | |
tree | 79acd363a5fce690443f438dcba33b1d88e03373 /drivers/kvm/mmu.c | |
parent | 55bf4028342d96b21fe5dc0721b481b0bc1e81f6 (diff) |
KVM: Use list_move()
Use list_move() where possible. Noticed by Dor Laor.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/mmu.c')
-rw-r--r-- | drivers/kvm/mmu.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index c738fb1cea30..d81b9cd3465f 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c | |||
@@ -437,9 +437,8 @@ static void kvm_mmu_free_page(struct kvm_vcpu *vcpu, hpa_t page_hpa) | |||
437 | struct kvm_mmu_page *page_head = page_header(page_hpa); | 437 | struct kvm_mmu_page *page_head = page_header(page_hpa); |
438 | 438 | ||
439 | ASSERT(is_empty_shadow_page(page_hpa)); | 439 | ASSERT(is_empty_shadow_page(page_hpa)); |
440 | list_del(&page_head->link); | ||
441 | page_head->page_hpa = page_hpa; | 440 | page_head->page_hpa = page_hpa; |
442 | list_add(&page_head->link, &vcpu->free_pages); | 441 | list_move(&page_head->link, &vcpu->free_pages); |
443 | ++vcpu->kvm->n_free_mmu_pages; | 442 | ++vcpu->kvm->n_free_mmu_pages; |
444 | } | 443 | } |
445 | 444 | ||
@@ -457,8 +456,7 @@ static struct kvm_mmu_page *kvm_mmu_alloc_page(struct kvm_vcpu *vcpu, | |||
457 | return NULL; | 456 | return NULL; |
458 | 457 | ||
459 | page = list_entry(vcpu->free_pages.next, struct kvm_mmu_page, link); | 458 | page = list_entry(vcpu->free_pages.next, struct kvm_mmu_page, link); |
460 | list_del(&page->link); | 459 | list_move(&page->link, &vcpu->kvm->active_mmu_pages); |
461 | list_add(&page->link, &vcpu->kvm->active_mmu_pages); | ||
462 | ASSERT(is_empty_shadow_page(page->page_hpa)); | 460 | ASSERT(is_empty_shadow_page(page->page_hpa)); |
463 | page->slot_bitmap = 0; | 461 | page->slot_bitmap = 0; |
464 | page->multimapped = 0; | 462 | page->multimapped = 0; |
@@ -670,10 +668,8 @@ static void kvm_mmu_zap_page(struct kvm_vcpu *vcpu, | |||
670 | if (!page->root_count) { | 668 | if (!page->root_count) { |
671 | hlist_del(&page->hash_link); | 669 | hlist_del(&page->hash_link); |
672 | kvm_mmu_free_page(vcpu, page->page_hpa); | 670 | kvm_mmu_free_page(vcpu, page->page_hpa); |
673 | } else { | 671 | } else |
674 | list_del(&page->link); | 672 | list_move(&page->link, &vcpu->kvm->active_mmu_pages); |
675 | list_add(&page->link, &vcpu->kvm->active_mmu_pages); | ||
676 | } | ||
677 | } | 673 | } |
678 | 674 | ||
679 | static int kvm_mmu_unprotect_page(struct kvm_vcpu *vcpu, gfn_t gfn) | 675 | static int kvm_mmu_unprotect_page(struct kvm_vcpu *vcpu, gfn_t gfn) |