diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2006-03-25 06:06:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 11:22:49 -0500 |
commit | c5e3b83e97be4e09961c0af101644643e5d03d17 (patch) | |
tree | 29863b7ff7452d10f0af51c3ff7ef72235e81c90 | |
parent | 40c07ae8daa659b8feb149c84731629386873c16 (diff) |
[PATCH] mm: use kmem_cache_zalloc
Convert mm/ to use the new kmem_cache_zalloc allocator.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | mm/mmap.c | 6 | ||||
-rw-r--r-- | mm/slab.c | 3 |
2 files changed, 3 insertions, 6 deletions
@@ -1040,12 +1040,11 @@ munmap_back: | |||
1040 | * specific mapper. the address has already been validated, but | 1040 | * specific mapper. the address has already been validated, but |
1041 | * not unmapped, but the maps are removed from the list. | 1041 | * not unmapped, but the maps are removed from the list. |
1042 | */ | 1042 | */ |
1043 | vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); | 1043 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
1044 | if (!vma) { | 1044 | if (!vma) { |
1045 | error = -ENOMEM; | 1045 | error = -ENOMEM; |
1046 | goto unacct_error; | 1046 | goto unacct_error; |
1047 | } | 1047 | } |
1048 | memset(vma, 0, sizeof(*vma)); | ||
1049 | 1048 | ||
1050 | vma->vm_mm = mm; | 1049 | vma->vm_mm = mm; |
1051 | vma->vm_start = addr; | 1050 | vma->vm_start = addr; |
@@ -1896,12 +1895,11 @@ unsigned long do_brk(unsigned long addr, unsigned long len) | |||
1896 | /* | 1895 | /* |
1897 | * create a vma struct for an anonymous mapping | 1896 | * create a vma struct for an anonymous mapping |
1898 | */ | 1897 | */ |
1899 | vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); | 1898 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
1900 | if (!vma) { | 1899 | if (!vma) { |
1901 | vm_unacct_memory(len >> PAGE_SHIFT); | 1900 | vm_unacct_memory(len >> PAGE_SHIFT); |
1902 | return -ENOMEM; | 1901 | return -ENOMEM; |
1903 | } | 1902 | } |
1904 | memset(vma, 0, sizeof(*vma)); | ||
1905 | 1903 | ||
1906 | vma->vm_mm = mm; | 1904 | vma->vm_mm = mm; |
1907 | vma->vm_start = addr; | 1905 | vma->vm_start = addr; |
@@ -1990,10 +1990,9 @@ kmem_cache_create (const char *name, size_t size, size_t align, | |||
1990 | align = ralign; | 1990 | align = ralign; |
1991 | 1991 | ||
1992 | /* Get cache's description obj. */ | 1992 | /* Get cache's description obj. */ |
1993 | cachep = kmem_cache_alloc(&cache_cache, SLAB_KERNEL); | 1993 | cachep = kmem_cache_zalloc(&cache_cache, SLAB_KERNEL); |
1994 | if (!cachep) | 1994 | if (!cachep) |
1995 | goto oops; | 1995 | goto oops; |
1996 | memset(cachep, 0, sizeof(struct kmem_cache)); | ||
1997 | 1996 | ||
1998 | #if DEBUG | 1997 | #if DEBUG |
1999 | cachep->obj_size = size; | 1998 | cachep->obj_size = size; |