2014-07-19 11:35:23

by Himangi Saraogi

[permalink] [raw]
Subject: [PATCH] mm/m68k: Eliminate memset after alloc_bootmem_pages

alloc_bootmem and related functions always return a zeroed region of memory.
Thus a memset after calls to these functions is unnecessary.

The following Coccinelle semantic patch was used for making the change:

@@
expression E,E1;
@@

E = \(alloc_bootmem\|alloc_bootmem_low\|alloc_bootmem_pages\|alloc_bootmem_low_pages\)(...)
... when != E
- memset(E,0,E1);

Signed-off-by: Himangi Saraogi <[email protected]>
Acked-by: Julia Lawall <[email protected]>
---
To send to: Geert Uytterhoeven <[email protected]>,[email protected],[email protected]
arch/m68k/mm/init.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index acaff6a..b09a3cb 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -94,7 +94,6 @@ void __init paging_init(void)
high_memory = (void *) end_mem;

empty_zero_page = alloc_bootmem_pages(PAGE_SIZE);
- memset(empty_zero_page, 0, PAGE_SIZE);

/*
* Set up SFC/DFC registers (user data space).
--
1.9.1


2014-11-10 08:57:49

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] mm/m68k: Eliminate memset after alloc_bootmem_pages

On Sat, Jul 19, 2014 at 1:35 PM, Himangi Saraogi <[email protected]> wrote:
> alloc_bootmem and related functions always return a zeroed region of memory.
> Thus a memset after calls to these functions is unnecessary.
>
> The following Coccinelle semantic patch was used for making the change:
>
> @@
> expression E,E1;
> @@
>
> E = \(alloc_bootmem\|alloc_bootmem_low\|alloc_bootmem_pages\|alloc_bootmem_low_pages\)(...)
> ... when != E
> - memset(E,0,E1);
>
> Signed-off-by: Himangi Saraogi <[email protected]>
> Acked-by: Julia Lawall <[email protected]>

Thanks, applied and queued for v3.19.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds