From d6f79b2710ad919f911cffe2f54f51891c023111 Mon Sep 17 00:00:00 2001 From: Navdeep Parhar Date: Mon, 3 Feb 2020 23:50:29 +0000 Subject: [PATCH] cxgbe(4): Avoid ext_arg2 in rxb_free. ext_arg2 is the only item in the third cacheline in an mbuf and could be cold by the time rxb_free runs. Put the information needed by rxb_free in the same line as the refcount, which is very likely to be hot given that rxb_free runs when the refcount is decremented and reaches 0. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 2 ++ sys/dev/cxgbe/t4_sge.c | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 31c2b403ede4..257e6bba50aa 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -326,6 +326,8 @@ struct cluster_layout { }; struct cluster_metadata { + uma_zone_t zone; + caddr_t cl; u_int refcount; }; diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index fff9f7b77975..de8c44890639 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -1804,10 +1804,9 @@ cl_metadata(struct adapter *sc, struct sge_fl *fl, struct cluster_layout *cll, static void rxb_free(struct mbuf *m) { - uma_zone_t zone = m->m_ext.ext_arg1; - void *cl = m->m_ext.ext_arg2; + struct cluster_metadata *clm = m->m_ext.ext_arg1; - uma_zfree(zone, cl); + uma_zfree(clm->zone, clm->cl); counter_u64_add(extfree_rels, 1); } @@ -1880,10 +1879,12 @@ get_scatter_segment(struct adapter *sc, struct sge_fl *fl, int fr_offset, fl->mbuf_inlined++; if (sd->nmbuf++ == 0) { clm->refcount = 1; + clm->zone = swz->zone; + clm->cl = sd->cl; counter_u64_add(extfree_refs, 1); } - m_extaddref(m, payload, blen, &clm->refcount, rxb_free, - swz->zone, sd->cl); + m_extaddref(m, payload, blen, &clm->refcount, rxb_free, clm, + NULL); } else { /* @@ -1899,10 +1900,12 @@ get_scatter_segment(struct adapter *sc, struct sge_fl *fl, int fr_offset, if (clm != NULL) { if (sd->nmbuf++ == 0) { clm->refcount = 1; + clm->zone = swz->zone; + clm->cl = sd->cl; counter_u64_add(extfree_refs, 1); } m_extaddref(m, payload, blen, &clm->refcount, - rxb_free, swz->zone, sd->cl); + rxb_free, clm, NULL); } else { m_cljset(m, sd->cl, swz->type); sd->cl = NULL; /* consumed, not a recycle candidate */