FreeBSD/sys/kern/kern_malloc.c
/*
 * An allocation has succeeded -- update malloc type statistics for the
 * amount of bucket size.  Occurs within a critical section so that the
 * thread isn't preempted and doesn't migrate while updating per-PCU
 * statistics.
 */
An allocation has succeeded -- update malloc type statistics for the
amount of bucket size.  Occurs within a critical section so that the
thread isn't preempted and doesn't migrate while updating per-PCU
statistics.
An allocation has succeeded -- update malloc type statistics for the amount of bucket size . Occurs within a critical section so that the thread isn ' t preempted and doesn ' t migrate while updating per - PCU statistics .
static void
malloc_type_zone_allocated(struct malloc_type *mtp, unsigned long size,
    int zindx)
{
	struct malloc_type_internal *mtip;
	struct malloc_type_stats *mtsp;
	critical_enter();
	mtip = mtp->ks_handle;
	mtsp = &mtip->mti_stats[curcpu];
	if (size > 0) {
		mtsp->mts_memalloced += size;
		mtsp->mts_numallocs++;
	}
	if (zindx != -1)
		mtsp->mts_size |= 1 << zindx;
#ifdef KDTRACE_HOOKS
	if (dtrace_malloc_probe != NULL) {
		uint32_t probe_id = mtip->mti_probes[DTMALLOC_PROBE_MALLOC];
		if (probe_id != 0)
			(dtrace_malloc_probe)(probe_id,
			    (uintptr_t) mtp, (uintptr_t) mtip,
			    (uintptr_t) mtsp, size, zindx);
	}
#endif
	critical_exit();
}
static void malloc_type_zone_allocated ( struct malloc_type * mtp , unsigned long size , int zindx ) { struct malloc_type_internal * mtip ; struct malloc_type_stats * mtsp ; critical_enter ( ) ; mtip = mtp -> ks_handle ; mtsp = & mtip -> mti_stats [ curcpu ] ; if ( size > 0 ) { mtsp -> mts_memalloced += size ; mtsp -> mts_numallocs ++ ; } if ( zindx != -1 ) mtsp -> mts_size |= 1 << zindx ; #ifdef KDTRACE_HOOKS if ( dtrace_malloc_probe != NULL ) { uint32_t probe_id = mtip -> mti_probes [ DTMALLOC_PROBE_MALLOC ] ; if ( probe_id != 0 ) ( dtrace_malloc_probe ) ( probe_id , ( uintptr_t ) mtp , ( uintptr_t ) mtip , ( uintptr_t ) mtsp , size , zindx ) ; } #endif critical_exit ( ) ; }
An allocation has succeeded -- update malloc type statistics for the
 amount of bucket size.
An allocation has succeeded -- update malloc type statistics for the amount of bucket size .