Exemplo n.º 1
0
/*
 * allocate anons
 */
void
uvm_anon_init()
{
	pool_init(&uvm_anon_pool, sizeof(struct vm_anon), 0, 0, 0, "anonpl",
	    &pool_allocator_nointr);
	pool_sethiwat(&uvm_anon_pool, uvmexp.free / 16);
}
Exemplo n.º 2
0
void
amap_init(void)
{
	/* Initialize the vm_amap pool. */
	pool_init(&uvm_amap_pool, sizeof(struct vm_amap), 0, 0, PR_WAITOK,
	    "amappl", NULL);
	pool_sethiwat(&uvm_amap_pool, 4096);
}
Exemplo n.º 3
0
void
nmbclust_update(void)
{
	/*
	 * Set the hard limit on the mclpool to the number of
	 * mbuf clusters the kernel is to support.  Log the limit
	 * reached message max once a minute.
	 */
	(void)pool_sethardlimit(&mclpool, nmbclust, mclpool_warnmsg, 60);
	pool_sethiwat(&mbpool, nmbclust);
}
Exemplo n.º 4
0
void
nmbclust_update(void)
{
	int i;
	/*
	 * Set the hard limit on the mclpools to the number of
	 * mbuf clusters the kernel is to support.  Log the limit
	 * reached message max once a minute.
	 */
	for (i = 0; i < nitems(mclsizes); i++) {
		(void)pool_sethardlimit(&mclpools[i], nmbclust,
		    mclpool_warnmsg, 60);
		/*
		 * XXX this needs to be reconsidered.
		 * Setting the high water mark to nmbclust is too high
		 * but we need to have enough spare buffers around so that
		 * allocations in interrupt context don't fail or mclgeti()
		 * drivers may end up with empty rings.
		 */
		pool_sethiwat(&mclpools[i], nmbclust);
	}
	pool_sethiwat(&mbpool, nmbclust);
}
Exemplo n.º 5
0
/*
 * Called by main() during pseudo-device attachment.  All we need
 * to do is allocate enough space for devices to be configured later.
 */
void
ccdattach(int num)
{
	int i;

	if (num <= 0) {
#ifdef DIAGNOSTIC
		panic("ccdattach: count <= 0");
#endif
		return;
	}

	ccd_softc = (struct ccd_softc *)malloc(num * sizeof(struct ccd_softc),
	    M_DEVBUF, M_NOWAIT);
	ccddevs = (struct ccddevice *)malloc(num * sizeof(struct ccddevice),
	    M_DEVBUF, M_NOWAIT);
	if ((ccd_softc == NULL) || (ccddevs == NULL)) {
		printf("WARNING: no memory for concatenated disks\n");
		if (ccd_softc != NULL)
			free(ccd_softc, M_DEVBUF);
		if (ccddevs != NULL)
			free(ccddevs, M_DEVBUF);
		return;
	}
	for (i = 0; i < num; i++) {
		rw_init(&ccd_softc[i].sc_rwlock, "ccdlock");
	}
	numccd = num;
	bzero(ccd_softc, num * sizeof(struct ccd_softc));
	bzero(ccddevs, num * sizeof(struct ccddevice));

	ccdbufsizeof = sizeof(struct ccdbuf) +
	    (CCD_SGMAX - 1) * sizeof(struct ccdseg);
	pool_init(&ccdbufpl, ccdbufsizeof, 0, 0, 0, "ccdbufpl", NULL);
	pool_setlowat(&ccdbufpl, 16);
	pool_sethiwat(&ccdbufpl, 1024);
}