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

Function malloc_large

freebsd/kern/kern_malloc.c:585–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

583}
584
585static caddr_t __noinline
586malloc_large(size_t *size, struct malloc_type *mtp, struct domainset *policy,
587 int flags DEBUG_REDZONE_ARG_DEF)
588{
589 vm_offset_t kva;
590 caddr_t va;
591 size_t sz;
592
593 sz = roundup(*size, PAGE_SIZE);
594 kva = kmem_malloc_domainset(policy, sz, flags);
595 if (kva != 0) {
596 /* The low bit is unused for slab pointers. */
597 vsetzoneslab(kva, NULL, (void *)((sz << 1) | 1));
598 uma_total_inc(sz);
599 *size = sz;
600 }
601 va = (caddr_t)kva;
602 malloc_type_allocated(mtp, va == NULL ? 0 : sz);
603 if (__predict_false(va == NULL)) {
604 KASSERT((flags & M_WAITOK) == 0,
605 ("malloc(M_WAITOK) returned NULL"));
606 }
607#ifdef DEBUG_REDZONE
608 if (va != NULL)
609 va = redzone_setup(va, osize);
610#endif
611 return (va);
612}
613
614static void
615free_large(void *addr, size_t size)

Callers 3

(malloc)Function · 0.85
malloc_domainsetFunction · 0.85
malloc_domainset_execFunction · 0.85

Calls 5

malloc_type_allocatedFunction · 0.85
redzone_setupFunction · 0.85
kmem_malloc_domainsetFunction · 0.50
vsetzoneslabFunction · 0.50
uma_total_incFunction · 0.50

Tested by

no test coverage detected