Kmem cache zalloc
Retired DISLab
(버전 사이의 차이)
(새 문서: http://lxr.free-electrons.com/source/include/linux/slab.h#L628 <source lang="c"> 625 - →626 * Shortcuts 627: 628 static inline void *kmem_cache_zalloc(struct kmem_cache *k, gfp_t...) |
|||
(한 사용자의 중간의 편집 1개 숨겨짐) | |||
7번째 줄: | 7번째 줄: | ||
628 static inline void *kmem_cache_zalloc(struct kmem_cache *k, gfp_t flags) | 628 static inline void *kmem_cache_zalloc(struct kmem_cache *k, gfp_t flags) | ||
629 { | 629 { | ||
− | 630 return kmem_cache_alloc(k, flags | __GFP_ZERO); | + | 630 return kmem_cache_alloc(k, flags | __GFP_ZERO); //GFP_ZERO is return zeroed page on success |
631 } | 631 } | ||
+ | |||
+ | 3456 /** | ||
+ | 3457 * kmem_cache_alloc - Allocate an object | ||
+ | 3458 * @cachep: The cache to allocate from. | ||
+ | 3459 * @flags: See kmalloc(). | ||
+ | 3460 * | ||
+ | 3461 * Allocate an object from this cache. The flags are only relevant | ||
+ | 3462 * if the cache has no available objects. | ||
+ | 3463 */ | ||
+ | 3464 void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags) | ||
+ | 3465 { | ||
+ | 3466 void *ret = slab_alloc(cachep, flags, _RET_IP_); | ||
+ | 3467 | ||
+ | 3468 trace_kmem_cache_alloc(_RET_IP_, ret, | ||
+ | 3469 cachep->object_size, cachep->size, flags); | ||
+ | 3470 | ||
+ | 3471 return ret; | ||
+ | 3472 } | ||
+ | 3473 EXPORT_SYMBOL(kmem_cache_alloc); | ||
+ | |||
</source> | </source> |
2014년 4월 30일 (수) 12:00 현재 판
http://lxr.free-electrons.com/source/include/linux/slab.h#L628
625 /* 626 * Shortcuts 627 */ 628 static inline void *kmem_cache_zalloc(struct kmem_cache *k, gfp_t flags) 629 { 630 return kmem_cache_alloc(k, flags | __GFP_ZERO); //GFP_ZERO is return zeroed page on success 631 } 3456 /** 3457 * kmem_cache_alloc - Allocate an object 3458 * @cachep: The cache to allocate from. 3459 * @flags: See kmalloc(). 3460 * 3461 * Allocate an object from this cache. The flags are only relevant 3462 * if the cache has no available objects. 3463 */ 3464 void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags) 3465 { 3466 void *ret = slab_alloc(cachep, flags, _RET_IP_); 3467 3468 trace_kmem_cache_alloc(_RET_IP_, ret, 3469 cachep->object_size, cachep->size, flags); 3470 3471 return ret; 3472 } 3473 EXPORT_SYMBOL(kmem_cache_alloc);