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
@@ -53,12 +53,9 @@ void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu)
|
||||
int node = cpu_to_node(cpu);
|
||||
|
||||
BUG_ON(pdata->ptrs[cpu]);
|
||||
if (node_online(node)) {
|
||||
/* FIXME: kzalloc_node(size, gfp, node) */
|
||||
pdata->ptrs[cpu] = kmalloc_node(size, gfp, node);
|
||||
if (pdata->ptrs[cpu])
|
||||
memset(pdata->ptrs[cpu], 0, size);
|
||||
} else
|
||||
if (node_online(node))
|
||||
pdata->ptrs[cpu] = kmalloc_node(size, gfp|__GFP_ZERO, node);
|
||||
else
|
||||
pdata->ptrs[cpu] = kzalloc(size, gfp);
|
||||
return pdata->ptrs[cpu];
|
||||
}
|
||||
|
Reference in New Issue
Block a user