diff options
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r-- | arch/x86/kvm/mmu.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 9696d654b01f..18d2f584945b 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2902,13 +2902,13 @@ restart: | |||
2902 | kvm_flush_remote_tlbs(kvm); | 2902 | kvm_flush_remote_tlbs(kvm); |
2903 | } | 2903 | } |
2904 | 2904 | ||
2905 | static void kvm_mmu_remove_one_alloc_mmu_page(struct kvm *kvm) | 2905 | static int kvm_mmu_remove_some_alloc_mmu_pages(struct kvm *kvm) |
2906 | { | 2906 | { |
2907 | struct kvm_mmu_page *page; | 2907 | struct kvm_mmu_page *page; |
2908 | 2908 | ||
2909 | page = container_of(kvm->arch.active_mmu_pages.prev, | 2909 | page = container_of(kvm->arch.active_mmu_pages.prev, |
2910 | struct kvm_mmu_page, link); | 2910 | struct kvm_mmu_page, link); |
2911 | kvm_mmu_zap_page(kvm, page); | 2911 | return kvm_mmu_zap_page(kvm, page) + 1; |
2912 | } | 2912 | } |
2913 | 2913 | ||
2914 | static int mmu_shrink(int nr_to_scan, gfp_t gfp_mask) | 2914 | static int mmu_shrink(int nr_to_scan, gfp_t gfp_mask) |
@@ -2920,7 +2920,7 @@ static int mmu_shrink(int nr_to_scan, gfp_t gfp_mask) | |||
2920 | spin_lock(&kvm_lock); | 2920 | spin_lock(&kvm_lock); |
2921 | 2921 | ||
2922 | list_for_each_entry(kvm, &vm_list, vm_list) { | 2922 | list_for_each_entry(kvm, &vm_list, vm_list) { |
2923 | int npages, idx; | 2923 | int npages, idx, freed_pages; |
2924 | 2924 | ||
2925 | idx = srcu_read_lock(&kvm->srcu); | 2925 | idx = srcu_read_lock(&kvm->srcu); |
2926 | spin_lock(&kvm->mmu_lock); | 2926 | spin_lock(&kvm->mmu_lock); |
@@ -2928,8 +2928,8 @@ static int mmu_shrink(int nr_to_scan, gfp_t gfp_mask) | |||
2928 | kvm->arch.n_free_mmu_pages; | 2928 | kvm->arch.n_free_mmu_pages; |
2929 | cache_count += npages; | 2929 | cache_count += npages; |
2930 | if (!kvm_freed && nr_to_scan > 0 && npages > 0) { | 2930 | if (!kvm_freed && nr_to_scan > 0 && npages > 0) { |
2931 | kvm_mmu_remove_one_alloc_mmu_page(kvm); | 2931 | freed_pages = kvm_mmu_remove_some_alloc_mmu_pages(kvm); |
2932 | cache_count--; | 2932 | cache_count -= freed_pages; |
2933 | kvm_freed = kvm; | 2933 | kvm_freed = kvm; |
2934 | } | 2934 | } |
2935 | nr_to_scan--; | 2935 | nr_to_scan--; |