]> git.karo-electronics.de Git - linux-beck.git/commitdiff
percpu: zero memory more efficiently in mm/percpu.c::pcpu_mem_alloc()
authorJesper Juhl <jj@chaosbits.net>
Sat, 30 Oct 2010 13:56:54 +0000 (15:56 +0200)
committerTejun Heo <tj@kernel.org>
Tue, 7 Dec 2010 13:47:23 +0000 (14:47 +0100)
Don't do vmalloc() + memset() when vzalloc() will do.

tj: dropped unnecessary temp variable ptr.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Tejun Heo <tj@kernel.org>
mm/percpu.c

index efe816856a9d777b284f8bf25cc7548154f374d6..9e16d1c9ebd5e6a05cf91ce21f4b9a248f7d3d4b 100644 (file)
@@ -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);
 }
 
 /**