FreeBSD/sys/kern/subr_vmem.c
/*
 * Import from the arena into the quantum cache in UMA.
 */
Import from the arena into the quantum cache in UMA.
Import from the arena into the quantum cache in UMA .
static int
qc_import(void *arg, void **store, int cnt, int flags)
{
	qcache_t *qc;
	vmem_addr_t addr;
	int i;
	qc = arg;
	if ((flags & VMEM_FITMASK) == 0)
		flags |= M_BESTFIT;
	for (i = 0; i < cnt; i++) {
		if (vmem_xalloc(qc->qc_vmem, qc->qc_size, 0, 0, 0,
		    VMEM_ADDR_MIN, VMEM_ADDR_MAX, flags, &addr) != 0)
			break;
		store[i] = (void *)addr;
		flags &= ~M_WAITOK;
		flags |= M_NOWAIT;
	}
	return i;
}
static int qc_import ( void * arg , void * * store , int cnt , int flags ) { qcache_t * qc ; vmem_addr_t addr ; int i ; qc = arg ; if ( ( flags & VMEM_FITMASK ) == 0 ) flags |= M_BESTFIT ; for ( i = 0 ; i < cnt ; i ++ ) { if ( vmem_xalloc ( qc -> qc_vmem , qc -> qc_size , 0 , 0 , 0 , VMEM_ADDR_MIN , VMEM_ADDR_MAX , flags , & addr ) != 0 ) break ; store [ i ] = ( void * ) addr ; flags &= ~ M_WAITOK ; flags |= M_NOWAIT ; } return i ; }
Import from the arena into the quantum cache in UMA.
Import from the arena into the quantum cache in UMA .
/* Only guarantee one allocation. */