Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 322261
b: refs/heads/master
c: 35f2d16
h: refs/heads/master
i:
  322259: 80536a3
v: v3
  • Loading branch information
Takuya Yoshikawa authored and Avi Kivity committed Aug 22, 2012
1 parent a3369c0 commit beaf426
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e8143ccb6b501f78bb95d9c5ee100d18423008cf
refs/heads/master: 35f2d16bb9ace0fb2671b8232839944ad9057c6f
13 changes: 9 additions & 4 deletions trunk/arch/x86/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -4112,17 +4112,22 @@ static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc)
int idx;
LIST_HEAD(invalid_list);

/*
* Never scan more than sc->nr_to_scan VM instances.
* Will not hit this condition practically since we do not try
* to shrink more than one VM and it is very unlikely to see
* !n_used_mmu_pages so many times.
*/
if (!nr_to_scan--)
break;
/*
* n_used_mmu_pages is accessed without holding kvm->mmu_lock
* here. We may skip a VM instance errorneosly, but we do not
* want to shrink a VM that only started to populate its MMU
* anyway.
*/
if (kvm->arch.n_used_mmu_pages > 0) {
if (!nr_to_scan--)
break;
if (!kvm->arch.n_used_mmu_pages)
continue;
}

idx = srcu_read_lock(&kvm->srcu);
spin_lock(&kvm->mmu_lock);
Expand Down

0 comments on commit beaf426

Please sign in to comment.