Slab allocators: Replace explicit zeroing with __GFP_ZERO
kmalloc_node() and kmem_cache_alloc_node() were not available in a zeroing variant in the past. But with __GFP_ZERO it is possible now to do zeroing while allocating. Use __GFP_ZERO to remove the explicit clearing of memory via memset whereever we can. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
81cda66261
commit
94f6030ca7
@@ -1221,7 +1221,8 @@ static int __devinit init_timers_cpu(int cpu)
|
||||
/*
|
||||
* The APs use this path later in boot
|
||||
*/
|
||||
base = kmalloc_node(sizeof(*base), GFP_KERNEL,
|
||||
base = kmalloc_node(sizeof(*base),
|
||||
GFP_KERNEL | __GFP_ZERO,
|
||||
cpu_to_node(cpu));
|
||||
if (!base)
|
||||
return -ENOMEM;
|
||||
@@ -1232,7 +1233,6 @@ static int __devinit init_timers_cpu(int cpu)
|
||||
kfree(base);
|
||||
return -ENOMEM;
|
||||
}
|
||||
memset(base, 0, sizeof(*base));
|
||||
per_cpu(tvec_bases, cpu) = base;
|
||||
} else {
|
||||
/*
|
||||
|
Reference in New Issue
Block a user