diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2009-12-23 11:35:25 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:35:45 -0500 |
commit | f656ce0185cabbbb0cf96877306879661297c7ad (patch) | |
tree | e2c8e61642ae4849c901922552a1acf0112461b4 /arch/x86/kvm/mmu.c | |
parent | e93f8a0f821e290ac5149830110a5f704db7a1fc (diff) |
KVM: switch vcpu context to use SRCU
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 f8bf42a25995..25aabd00aa01 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2933,10 +2933,9 @@ static int mmu_shrink(int nr_to_scan, gfp_t gfp_mask) | |||
2933 | spin_lock(&kvm_lock); | 2933 | spin_lock(&kvm_lock); |
2934 | 2934 | ||
2935 | list_for_each_entry(kvm, &vm_list, vm_list) { | 2935 | list_for_each_entry(kvm, &vm_list, vm_list) { |
2936 | int npages; | 2936 | int npages, idx; |
2937 | 2937 | ||
2938 | if (!down_read_trylock(&kvm->slots_lock)) | 2938 | idx = srcu_read_lock(&kvm->srcu); |
2939 | continue; | ||
2940 | spin_lock(&kvm->mmu_lock); | 2939 | spin_lock(&kvm->mmu_lock); |
2941 | npages = kvm->arch.n_alloc_mmu_pages - | 2940 | npages = kvm->arch.n_alloc_mmu_pages - |
2942 | kvm->arch.n_free_mmu_pages; | 2941 | kvm->arch.n_free_mmu_pages; |
@@ -2949,7 +2948,7 @@ static int mmu_shrink(int nr_to_scan, gfp_t gfp_mask) | |||
2949 | nr_to_scan--; | 2948 | nr_to_scan--; |
2950 | 2949 | ||
2951 | spin_unlock(&kvm->mmu_lock); | 2950 | spin_unlock(&kvm->mmu_lock); |
2952 | up_read(&kvm->slots_lock); | 2951 | srcu_read_unlock(&kvm->srcu, idx); |
2953 | } | 2952 | } |
2954 | if (kvm_freed) | 2953 | if (kvm_freed) |
2955 | list_move_tail(&kvm_freed->vm_list, &vm_list); | 2954 | list_move_tail(&kvm_freed->vm_list, &vm_list); |