MCPcopy Create free account
hub / github.com/F-Stack/f-stack / uma_zcreate

Function uma_zcreate

freebsd/vm/uma_core.c:3062–3105  ·  view source on GitHub ↗

See uma.h */

Source from the content-addressed store, hash-verified

3060
3061/* See uma.h */
3062uma_zone_t
3063uma_zcreate(const char *name, size_t size, uma_ctor ctor, uma_dtor dtor,
3064 uma_init uminit, uma_fini fini, int align, uint32_t flags)
3065
3066{
3067 struct uma_zctor_args args;
3068 uma_zone_t res;
3069
3070 KASSERT(powerof2(align + 1), ("invalid zone alignment %d for \"%s\"",
3071 align, name));
3072
3073 /* This stuff is essential for the zone ctor */
3074 memset(&args, 0, sizeof(args));
3075 args.name = name;
3076 args.size = size;
3077 args.ctor = ctor;
3078 args.dtor = dtor;
3079 args.uminit = uminit;
3080 args.fini = fini;
3081#ifdef INVARIANTS
3082 /*
3083 * Inject procedures which check for memory use after free if we are
3084 * allowed to scramble the memory while it is not allocated. This
3085 * requires that: UMA is actually able to access the memory, no init
3086 * or fini procedures, no dependency on the initial value of the
3087 * memory, and no (legitimate) use of the memory after free. Note,
3088 * the ctor and dtor do not need to be empty.
3089 */
3090 if ((!(flags & (UMA_ZONE_ZINIT | UMA_ZONE_NOTOUCH |
3091 UMA_ZONE_NOFREE))) && uminit == NULL && fini == NULL) {
3092 args.uminit = trash_init;
3093 args.fini = trash_fini;
3094 }
3095#endif
3096 args.align = align;
3097 args.flags = flags;
3098 args.keg = NULL;
3099
3100 sx_slock(&uma_reclaim_lock);
3101 res = zone_alloc_item(zones, &args, UMA_ANYDOMAIN, M_WAITOK);
3102 sx_sunlock(&uma_reclaim_lock);
3103
3104 return (res);
3105}
3106
3107/* See uma.h */
3108uma_zone_t

Callers 15

kmem_cache_createFunction · 0.85
system_taskq_initFunction · 0.85
zfs_znode_initFunction · 0.85
pf_load_vnetFunction · 0.85
pf_normalize_initFunction · 0.85
pfr_initializeFunction · 0.85
pf_mtag_initializeFunction · 0.85
pf_initializeFunction · 0.85
ipfw_dyn_initFunction · 0.85
ipfw_init_countersFunction · 0.85
nat64lsn_init_internalFunction · 0.85
audit_initFunction · 0.85

Calls 2

memsetFunction · 0.85
zone_alloc_itemFunction · 0.85

Tested by

no test coverage detected