Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156585
b: refs/heads/master
c: 025dbbf
h: refs/heads/master
i:
  156583: 6569765
v: v3
  • Loading branch information
Marcelo Tosatti authored and Avi Kivity committed Aug 5, 2009
1 parent 2b97d87 commit a75dc31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 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: 4b656b1202498184a0ecef86b3b89ff613b9c6ab
refs/heads/master: 025dbbf36a7680bffe54d9dcbf0a8bc01a7cbd10
15 changes: 8 additions & 7 deletions trunk/arch/x86/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1407,24 +1407,25 @@ static int kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp)
*/
void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages)
{
int used_pages;

used_pages = kvm->arch.n_alloc_mmu_pages - kvm->arch.n_free_mmu_pages;
used_pages = max(0, used_pages);

/*
* If we set the number of mmu pages to be smaller be than the
* number of actived pages , we must to free some mmu pages before we
* change the value
*/

if ((kvm->arch.n_alloc_mmu_pages - kvm->arch.n_free_mmu_pages) >
kvm_nr_mmu_pages) {
int n_used_mmu_pages = kvm->arch.n_alloc_mmu_pages
- kvm->arch.n_free_mmu_pages;

while (n_used_mmu_pages > kvm_nr_mmu_pages) {
if (used_pages > kvm_nr_mmu_pages) {
while (used_pages > kvm_nr_mmu_pages) {
struct kvm_mmu_page *page;

page = container_of(kvm->arch.active_mmu_pages.prev,
struct kvm_mmu_page, link);
kvm_mmu_zap_page(kvm, page);
n_used_mmu_pages--;
used_pages--;
}
kvm->arch.n_free_mmu_pages = 0;
}
Expand Down

0 comments on commit a75dc31

Please sign in to comment.