diff mbox series

[kvm-unit-tests,v3,4/4] arm: Remove redundant page zeroing

Message ID 20190509200558.12347-5-nadav.amit@gmail.com (mailing list archive)
State New, archived
Headers show
Series Zero allocated pages | expand

Commit Message

Nadav Amit May 9, 2019, 8:05 p.m. UTC
Now that alloc_page() zeros the page, remove the redundant page zeroing.

Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Suggested-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
---
 lib/arm/asm/pgtable.h   | 2 --
 lib/arm/mmu.c           | 1 -
 lib/arm64/asm/pgtable.h | 1 -
 3 files changed, 4 deletions(-)

Comments

Andrew Jones May 15, 2019, 9:27 a.m. UTC | #1
On Thu, May 09, 2019 at 01:05:58PM -0700, Nadav Amit wrote:
> Now that alloc_page() zeros the page, remove the redundant page zeroing.
> 
> Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
> Suggested-by: Andrew Jones <drjones@redhat.com>
> Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
> ---
>  lib/arm/asm/pgtable.h   | 2 --
>  lib/arm/mmu.c           | 1 -
>  lib/arm64/asm/pgtable.h | 1 -
>  3 files changed, 4 deletions(-)
> 
> diff --git a/lib/arm/asm/pgtable.h b/lib/arm/asm/pgtable.h
> index b614bce..241dff6 100644
> --- a/lib/arm/asm/pgtable.h
> +++ b/lib/arm/asm/pgtable.h
> @@ -53,7 +53,6 @@ static inline pmd_t *pmd_alloc_one(void)
>  {
>  	assert(PTRS_PER_PMD * sizeof(pmd_t) == PAGE_SIZE);
>  	pmd_t *pmd = alloc_page();
> -	memset(pmd, 0, PTRS_PER_PMD * sizeof(pmd_t));
>  	return pmd;
>  }
>  static inline pmd_t *pmd_alloc(pgd_t *pgd, unsigned long addr)
> @@ -80,7 +79,6 @@ static inline pte_t *pte_alloc_one(void)
>  {
>  	assert(PTRS_PER_PTE * sizeof(pte_t) == PAGE_SIZE);
>  	pte_t *pte = alloc_page();
> -	memset(pte, 0, PTRS_PER_PTE * sizeof(pte_t));
>  	return pte;
>  }
>  static inline pte_t *pte_alloc(pmd_t *pmd, unsigned long addr)
> diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c
> index 03f6622..3d38c83 100644
> --- a/lib/arm/mmu.c
> +++ b/lib/arm/mmu.c
> @@ -166,7 +166,6 @@ void *setup_mmu(phys_addr_t phys_end)
>  #endif
>  
>  	mmu_idmap = alloc_page();
> -	memset(mmu_idmap, 0, PAGE_SIZE);
>  
>  	/*
>  	 * mach-virt I/O regions:
> diff --git a/lib/arm64/asm/pgtable.h b/lib/arm64/asm/pgtable.h
> index 5860abe..ee0a2c8 100644
> --- a/lib/arm64/asm/pgtable.h
> +++ b/lib/arm64/asm/pgtable.h
> @@ -61,7 +61,6 @@ static inline pte_t *pte_alloc_one(void)
>  {
>  	assert(PTRS_PER_PTE * sizeof(pte_t) == PAGE_SIZE);
>  	pte_t *pte = alloc_page();
> -	memset(pte, 0, PTRS_PER_PTE * sizeof(pte_t));
>  	return pte;
>  }
>  static inline pte_t *pte_alloc(pmd_t *pmd, unsigned long addr)
> -- 
> 2.17.1
>

Reviewed-by: Andrew Jones <drjones@redhat.com>
diff mbox series

Patch

diff --git a/lib/arm/asm/pgtable.h b/lib/arm/asm/pgtable.h
index b614bce..241dff6 100644
--- a/lib/arm/asm/pgtable.h
+++ b/lib/arm/asm/pgtable.h
@@ -53,7 +53,6 @@  static inline pmd_t *pmd_alloc_one(void)
 {
 	assert(PTRS_PER_PMD * sizeof(pmd_t) == PAGE_SIZE);
 	pmd_t *pmd = alloc_page();
-	memset(pmd, 0, PTRS_PER_PMD * sizeof(pmd_t));
 	return pmd;
 }
 static inline pmd_t *pmd_alloc(pgd_t *pgd, unsigned long addr)
@@ -80,7 +79,6 @@  static inline pte_t *pte_alloc_one(void)
 {
 	assert(PTRS_PER_PTE * sizeof(pte_t) == PAGE_SIZE);
 	pte_t *pte = alloc_page();
-	memset(pte, 0, PTRS_PER_PTE * sizeof(pte_t));
 	return pte;
 }
 static inline pte_t *pte_alloc(pmd_t *pmd, unsigned long addr)
diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c
index 03f6622..3d38c83 100644
--- a/lib/arm/mmu.c
+++ b/lib/arm/mmu.c
@@ -166,7 +166,6 @@  void *setup_mmu(phys_addr_t phys_end)
 #endif
 
 	mmu_idmap = alloc_page();
-	memset(mmu_idmap, 0, PAGE_SIZE);
 
 	/*
 	 * mach-virt I/O regions:
diff --git a/lib/arm64/asm/pgtable.h b/lib/arm64/asm/pgtable.h
index 5860abe..ee0a2c8 100644
--- a/lib/arm64/asm/pgtable.h
+++ b/lib/arm64/asm/pgtable.h
@@ -61,7 +61,6 @@  static inline pte_t *pte_alloc_one(void)
 {
 	assert(PTRS_PER_PTE * sizeof(pte_t) == PAGE_SIZE);
 	pte_t *pte = alloc_page();
-	memset(pte, 0, PTRS_PER_PTE * sizeof(pte_t));
 	return pte;
 }
 static inline pte_t *pte_alloc(pmd_t *pmd, unsigned long addr)