Zero memory more efficiently in mm/percpu.c::pcpu_mem_alloc()
Subsystems (2)
PATCH 1/1 Zero memory more efficiently in mm/percpu.c::pcpu_mem_alloc()
Don't do vmalloc() + memset() when vzalloc() will do.
Signed-off-by Jesper Juhl <[email protected]>
--- percpu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
mm/percpu.c +1 -3
@@ -294,9 +294,7 @@ static void *pcpu_mem_alloc(size_t size)if (size <=PAGE_SIZE )return kzalloc (size,GFP_KERNEL );else { -void *ptr =vmalloc (size); -if (ptr) -memset (ptr,0 , size); +void *ptr =vzalloc (size);return ptr; } }
Signature · 9 lines
Jesper Juhl <[email protected]> http://www.chaosbits.net/ Plain text mails only, please http://www.expita.com/nomime.html Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Tejun Heo
maintainerPATCH 1/1 percpu: zero memory more efficiently in mm/percpu.c::pcpu_mem_alloc()
Don't do vmalloc() + memset() when vzalloc() will do.
tj: dropped unnecessary temp variable ptr.
Signed-off-by Jesper Juhl <[email protected]>
Signed-off-by Tejun Heo <[email protected]>
---
Applied with slight modification. Thank you.
mm/percpu.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
mm/percpu.c +2 -6
@@ -293,12 +293,8 @@ static void *pcpu_mem_alloc(size_t size)if (size <=PAGE_SIZE )return kzalloc (size,GFP_KERNEL ); -else { -void *ptr =vmalloc (size); -if (ptr) -memset (ptr,0 , size); -return ptr; - } +else +return vzalloc (size); }/**
Signature · 7 lines
1.7.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH] percpu: zero memory more efficiently in mm/percpu.c::pcpu_mem_alloc()
Quoted 4 lines · Tejun Heo
Don't do
vmalloc()+memset()whenvzalloc()will do.tj: dropped unnecessary temp variable ptr.
I must be needing glasses, I should have seen that initially. Thanks for fixing that up :)
Signature · 3 lines
Jesper Juhl <[email protected]> http://www.chaosbits.net/ Plain text mails only, please http://www.expita.com/nomime.html Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html