Skip to contentSkip to conversation

sparc32: remove redundant memsets after memblock allocations

PATCH In review Sang-Heon Jeon 2 participants 5 messages Aug 27 – Oct 9 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

cover sparc32: remove redundant memsets after memblock allocations

memblock_alloc() and memblock_alloc_or_panic() return zeroed memory, so the memsets after the allocations are redundant.

Sang-Heon Jeon (2):
sparc32: remove redundant memset in arch_mm_preinit()
sparc32: remove redundant memset in srmmu_nocache_init()

 arch/sparc/mm/init_32.c | 1 -
 arch/sparc/mm/srmmu.c   | 1 -
 2 files changed, 2 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 sparc32: remove redundant memset in arch_mm_preinit()

memblock_alloc() returns zeroed memory, so the memset after the allocation is redundant.

No functional change.

---
 arch/sparc/mm/init_32.c | 1 -
 1 file changed, 1 deletion(-)
arch/sparc/mm/init_32.c +0 -1
index e0e66f91ceeb..b4f31d41d665 100644
@@ -255,7 +255,6 @@ void __init arch_mm_preinit(void)
 		prom_printf("mem_init: Cannot alloc valid_addr_bitmap.\n");
 		prom_halt();
 	}
-	memset(sparc_valid_addr_bitmap, 0, i << 2);
 
 	taint_real_pages();
 }
Signature · 1 line
2.43.0
maintainer
#2 lore raw

Re: [PATCH 1/2] sparc32: remove redundant memset in arch_mm_preinit()

Quoted 15 lines · Sang-Heon Jeon

memblock_alloc() returns zeroed memory, so the memset after the allocation is redundant.

No functional change.

---
 arch/sparc/mm/init_32.c | 1 -
 1 file changed, 1 deletion(-)
arch/sparc/mm/init_32.c +0 -0
index e0e66f91ceeb..b4f31d41d665 100644

arch/sparc/mm/init_32.c void __init arch_mm_preinit(void) · line 260

Quoted 7 lines
arch/sparc/mm/init_32.c +0 -1
@@ -255,7 +255,6 @@ void __init arch_mm_preinit(void)
 		prom_printf("mem_init: Cannot alloc valid_addr_bitmap.\n");
 		prom_halt();
 	}
-	memset(sparc_valid_addr_bitmap, 0, i << 2);
 
 	taint_real_pages();
 }

No need for this anymore as this code is gone on my for-next thanks to commit 91c897e01883 ("sparc32: drop unused valid address bitmap").

Cheers,
Andreas

#3 lore raw

PATCH 2/2 sparc32: remove redundant memset in srmmu_nocache_init()

In reply to Sang-Heon Jeon

memblock_alloc_or_panic() returns zeroed memory, so the memset after the allocation is redundant.

No functional change.

---
 arch/sparc/mm/srmmu.c | 1 -
 1 file changed, 1 deletion(-)
arch/sparc/mm/srmmu.c +0 -1
index 9a74902ad181..f9a92a07a255 100644
@@ -279,7 +279,6 @@ static void __init srmmu_nocache_init(void)
 
 	srmmu_nocache_pool = memblock_alloc_or_panic(srmmu_nocache_size,
 					    SRMMU_NOCACHE_ALIGN_MAX);
-	memset(srmmu_nocache_pool, 0, srmmu_nocache_size);
 
 	srmmu_nocache_bitmap =
 		memblock_alloc_or_panic(BITS_TO_LONGS(bitmap_bits) * sizeof(long),
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] sparc32: remove redundant memset in srmmu_nocache_init()

Quoted 15 lines · Sang-Heon Jeon

memblock_alloc_or_panic() returns zeroed memory, so the memset after the allocation is redundant.

No functional change.

---
 arch/sparc/mm/srmmu.c | 1 -
 1 file changed, 1 deletion(-)
arch/sparc/mm/srmmu.c +0 -0
index 9a74902ad181..f9a92a07a255 100644

arch/sparc/mm/srmmu.c static void __init srmmu_nocache_init(void) · line 284

Quoted 7 lines
arch/sparc/mm/srmmu.c +0 -1
@@ -279,7 +279,6 @@ static void __init srmmu_nocache_init(void)
 
 	srmmu_nocache_pool = memblock_alloc_or_panic(srmmu_nocache_size,
 					    SRMMU_NOCACHE_ALIGN_MAX);
-	memset(srmmu_nocache_pool, 0, srmmu_nocache_size);
 
 	srmmu_nocache_bitmap =
 		memblock_alloc_or_panic(BITS_TO_LONGS(bitmap_bits) * sizeof(long),

Picking this up to my for-next.

Thanks,
Andreas