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

Function malloc_domainset

freebsd/kern/kern_malloc.c:694–732  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

692}
693
694void *
695malloc_domainset(size_t size, struct malloc_type *mtp, struct domainset *ds,
696 int flags)
697{
698 struct vm_domainset_iter di;
699 caddr_t va;
700 int domain;
701 int indx;
702#ifdef DEBUG_REDZONE
703 unsigned long osize = size;
704#endif
705
706 MPASS((flags & M_EXEC) == 0);
707
708#ifdef MALLOC_DEBUG
709 va = NULL;
710 if (malloc_dbg(&va, &size, mtp, flags) != 0)
711 return (va);
712#endif
713
714 if (__predict_false(size > kmem_zmax))
715 return (malloc_large(&size, mtp, DOMAINSET_RR(), flags
716 DEBUG_REDZONE_ARG));
717
718 vm_domainset_iter_policy_init(&di, ds, &domain, &flags);
719 do {
720 va = malloc_domain(&size, &indx, mtp, domain, flags);
721 } while (va == NULL && vm_domainset_iter_policy(&di, &domain) == 0);
722 malloc_type_zone_allocated(mtp, va == NULL ? 0 : size, indx);
723 if (__predict_false(va == NULL)) {
724 KASSERT((flags & M_WAITOK) == 0,
725 ("malloc(M_WAITOK) returned NULL"));
726 }
727#ifdef DEBUG_REDZONE
728 if (va != NULL)
729 va = redzone_setup(va, osize);
730#endif
731 return (va);
732}
733
734/*
735 * Allocate an executable area.

Callers 10

init_hwpmcFunction · 0.70
device_set_driverFunction · 0.70
callout_cpu_initFunction · 0.70
malloc_domainset_alignedFunction · 0.70
bounce_bus_dmamap_createFunction · 0.50
bounce_bus_dmamem_allocFunction · 0.50
alloc_bounce_pagesFunction · 0.50
hw_mds_recalculateFunction · 0.50
if_alloc_domainFunction · 0.50

Calls 7

malloc_dbgFunction · 0.85
malloc_largeFunction · 0.85
malloc_domainFunction · 0.85
redzone_setupFunction · 0.85
vm_domainset_iter_policyFunction · 0.50

Tested by

no test coverage detected