Date: Tue, 18 Mar 2014 13:55:01 +0400 From: Andrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru> To: net@FreeBSD.org Subject: [PATCH 2/6] sfxge: limit software Tx queue size Message-ID: <532817F5.8010505@oktetlabs.ru>
next in thread | raw e-mail | index | archive | help
sfxge: limit software Tx queue size Previous implementation limits put queue size only (when Tx lock can't be acquired), but get queue may grow unboundedly which results in mbuf pools exhaustion and latency growth. Submitted-by: Andrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru> Sponsored by: Solarflare Communications, Inc. diff -r ff9f5d3dbafe -r 7632a3355224 src/driver/freebsd/sfxge_tx.c --- a/head/sys/dev/sfxge/sfxge_tx.c Tue Mar 04 13:15:13 2014 +0400 +++ b/head/sys/dev/sfxge/sfxge_tx.c Wed Mar 05 09:06:01 2014 +0400 @@ -461,6 +461,9 @@ sfxge_tx_qdpl_swizzle(txq); + if (stdp->std_count >= SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT) + return ENOBUFS; + *(stdp->std_getp) = mbuf; stdp->std_getp = &mbuf->m_nextpkt; stdp->std_count++; @@ -480,7 +483,7 @@ old_len = mp->m_pkthdr.csum_data; } else old_len = 0; - if (old_len >= SFXGE_TX_MAX_DEFERRED) + if (old_len >= SFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT) return ENOBUFS; mbuf->m_pkthdr.csum_data = old_len + 1; mbuf->m_nextpkt = (void *)old; @@ -507,12 +510,9 @@ */ locked = mtx_trylock(&txq->lock); - /* - * Can only fail if we weren't able to get the lock. - */ if (sfxge_tx_qdpl_put(txq, m, locked) != 0) { - KASSERT(!locked, - ("sfxge_tx_qdpl_put() failed locked")); + if (locked) + mtx_unlock(&txq->lock); rc = ENOBUFS; goto fail; } diff -r ff9f5d3dbafe -r 7632a3355224 src/driver/freebsd/sfxge_tx.h --- a/head/sys/dev/sfxge/sfxge_tx.h Tue Mar 04 13:15:13 2014 +0400 +++ b/head/sys/dev/sfxge/sfxge_tx.h Wed Mar 05 09:06:01 2014 +0400 @@ -75,7 +75,8 @@ enum sfxge_tx_buf_flags flags; }; -#define SFXGE_TX_MAX_DEFERRED 64 +#define SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT 64 +#define SFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT 64 /* * Deferred packet list.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?532817F5.8010505>