aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2011-03-04 06:01:10 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2011-03-17 12:08:32 -0400
commit842f22ed9b3c545e7c53adbdea0d82efdcd1aa7f (patch)
tree6539ce464de1303e6c07b8172ab56eecdb103ea4 /arch/x86/kvm/mmu.c
parent49b26e26e4b7b94753b39f7edb0c34f3d1c4c167 (diff)
KVM: MMU: cleanup page alloc and free
Using __get_free_page instead of alloc_page and page_address, using free_page instead of __free_page and virt_to_page Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 91a194667432..52645e342db1 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -379,15 +379,15 @@ static void mmu_free_memory_cache(struct kvm_mmu_memory_cache *mc,
379static int mmu_topup_memory_cache_page(struct kvm_mmu_memory_cache *cache, 379static int mmu_topup_memory_cache_page(struct kvm_mmu_memory_cache *cache,
380 int min) 380 int min)
381{ 381{
382 struct page *page; 382 void *page;
383 383
384 if (cache->nobjs >= min) 384 if (cache->nobjs >= min)
385 return 0; 385 return 0;
386 while (cache->nobjs < ARRAY_SIZE(cache->objects)) { 386 while (cache->nobjs < ARRAY_SIZE(cache->objects)) {
387 page = alloc_page(GFP_KERNEL); 387 page = (void *)__get_free_page(GFP_KERNEL);
388 if (!page) 388 if (!page)
389 return -ENOMEM; 389 return -ENOMEM;
390 cache->objects[cache->nobjs++] = page_address(page); 390 cache->objects[cache->nobjs++] = page;
391 } 391 }
392 return 0; 392 return 0;
393} 393}
@@ -1032,9 +1032,9 @@ static void kvm_mmu_free_page(struct kvm *kvm, struct kvm_mmu_page *sp)
1032 ASSERT(is_empty_shadow_page(sp->spt)); 1032 ASSERT(is_empty_shadow_page(sp->spt));
1033 hlist_del(&sp->hash_link); 1033 hlist_del(&sp->hash_link);
1034 list_del(&sp->link); 1034 list_del(&sp->link);
1035 __free_page(virt_to_page(sp->spt)); 1035 free_page((unsigned long)sp->spt);
1036 if (!sp->role.direct) 1036 if (!sp->role.direct)
1037 __free_page(virt_to_page(sp->gfns)); 1037 free_page((unsigned long)sp->gfns);
1038 kmem_cache_free(mmu_page_header_cache, sp); 1038 kmem_cache_free(mmu_page_header_cache, sp);
1039 kvm_mod_used_mmu_pages(kvm, -1); 1039 kvm_mod_used_mmu_pages(kvm, -1);
1040} 1040}