mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
81cda66261
commit
94f6030ca7
12 changed files with 30 additions and 38 deletions
|
|
@ -432,11 +432,12 @@ void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
|
|||
area->nr_pages = nr_pages;
|
||||
/* Please note that the recursion is strictly bounded. */
|
||||
if (array_size > PAGE_SIZE) {
|
||||
pages = __vmalloc_node(array_size, gfp_mask, PAGE_KERNEL, node);
|
||||
pages = __vmalloc_node(array_size, gfp_mask | __GFP_ZERO,
|
||||
PAGE_KERNEL, node);
|
||||
area->flags |= VM_VPAGES;
|
||||
} else {
|
||||
pages = kmalloc_node(array_size,
|
||||
(gfp_mask & GFP_LEVEL_MASK),
|
||||
(gfp_mask & GFP_LEVEL_MASK) | __GFP_ZERO,
|
||||
node);
|
||||
}
|
||||
area->pages = pages;
|
||||
|
|
@ -445,7 +446,6 @@ void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
|
|||
kfree(area);
|
||||
return NULL;
|
||||
}
|
||||
memset(area->pages, 0, array_size);
|
||||
|
||||
for (i = 0; i < area->nr_pages; i++) {
|
||||
if (node < 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue