Index: uipc_mbuf.c =================================================================== RCS file: /cvs/src/sys/kern/uipc_mbuf.c,v retrieving revision 1.199 diff -u -p -r1.199 uipc_mbuf.c --- uipc_mbuf.c 11 Dec 2014 19:21:57 -0000 1.199 +++ uipc_mbuf.c 28 Dec 2014 09:25:22 -0000 @@ -147,7 +147,6 @@ mbinit(void) pool_init(&mbpool, MSIZE, 0, 0, 0, "mbufpl", NULL); pool_setipl(&mbpool, IPL_NET); pool_set_constraints(&mbpool, &kp_dma_contig); - pool_setlowat(&mbpool, mblowat); pool_init(&mtagpool, PACKET_TAG_MAXSIZE + sizeof(struct m_tag), 0, 0, 0, "mtagpl", NULL); @@ -156,11 +155,10 @@ mbinit(void) for (i = 0; i < nitems(mclsizes); i++) { snprintf(mclnames[i], sizeof(mclnames[0]), "mcl%dk", mclsizes[i] >> 10); - pool_init(&mclpools[i], mclsizes[i], 0, 0, 0, + pool_init(&mclpools[i], mclsizes[i], 1024, 0, 0, mclnames[i], NULL); pool_setipl(&mclpools[i], IPL_NET); pool_set_constraints(&mclpools[i], &kp_dma_contig); - pool_setlowat(&mclpools[i], mcllowat); } nmbclust_update(); @@ -169,25 +167,7 @@ mbinit(void) 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); + (void)pool_sethardlimit(&mbpool, nmbclust, mclpool_warnmsg, 60); } /* @@ -1356,14 +1336,24 @@ mq_dequeue(struct mbuf_queue *mq) int mq_enlist(struct mbuf_queue *mq, struct mbuf_list *ml) { - int full; + struct mbuf *m; + int dropped = 0; mtx_enter(&mq->mq_mtx); - ml_join(&mq->mq_list, ml); - full = mq_len(mq) >= mq->mq_maxlen; + if (mq_len(mq) < mq->mq_maxlen) + ml_join(&mq->mq_list, ml); + else { + mq->mq_drops += ml_len(ml); + dropped = 1; + } mtx_leave(&mq->mq_mtx); - return (full); + if (dropped) { + while ((m = ml_dequeue(ml)) != NULL) + m_freem(m); + } + + return (dropped); } void