KVM: MMU: drop zeroing on mmu_memory_cache_alloc
diff mbox

Message ID 20090108194419.GA8176@amt.cnet
State Accepted
Headers show

Commit Message

Marcelo Tosatti Jan. 8, 2009, 7:44 p.m. UTC
Zeroing on mmu_memory_cache_alloc is unnecessary since:

- Smaller areas are pre-allocated with kmem_cache_zalloc.
- Page pointed by ->spt is overwritten with prefetch_page 
  and entries in page pointed by ->gfns are initialized 
  before reading.

[avi: zeroing pages is unnecessary]

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Avi Kivity Jan. 11, 2009, 7:14 a.m. UTC | #1
Marcelo Tosatti wrote:
> Zeroing on mmu_memory_cache_alloc is unnecessary since:
>
> - Smaller areas are pre-allocated with kmem_cache_zalloc.
> - Page pointed by ->spt is overwritten with prefetch_page 
>   and entries in page pointed by ->gfns are initialized 
>   before reading.
>
> [avi: zeroing pages is unnecessary]
>
>   

Applied, thanks.

Patch
diff mbox

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 10bdb2a..823d0cd 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -352,7 +352,6 @@  static void *mmu_memory_cache_alloc(struct kvm_mmu_memory_cache *mc,
 
 	BUG_ON(!mc->nobjs);
 	p = mc->objects[--mc->nobjs];
-	memset(p, 0, size);
 	return p;
 }