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
This commit is contained in:
np 2020-02-03 23:50:29 +00:00
parent f1ec5116a1
commit d0afeee86f
2 changed files with 11 additions and 6 deletions

View File

@ -326,6 +326,8 @@ struct cluster_layout {
}; };
struct cluster_metadata { struct cluster_metadata {
uma_zone_t zone;
caddr_t cl;
u_int refcount; u_int refcount;
}; };

View File

@ -1804,10 +1804,9 @@ cl_metadata(struct adapter *sc, struct sge_fl *fl, struct cluster_layout *cll,
static void static void
rxb_free(struct mbuf *m) rxb_free(struct mbuf *m)
{ {
uma_zone_t zone = m->m_ext.ext_arg1; struct cluster_metadata *clm = m->m_ext.ext_arg1;
void *cl = m->m_ext.ext_arg2;
uma_zfree(zone, cl); uma_zfree(clm->zone, clm->cl);
counter_u64_add(extfree_rels, 1); 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++; fl->mbuf_inlined++;
if (sd->nmbuf++ == 0) { if (sd->nmbuf++ == 0) {
clm->refcount = 1; clm->refcount = 1;
clm->zone = swz->zone;
clm->cl = sd->cl;
counter_u64_add(extfree_refs, 1); counter_u64_add(extfree_refs, 1);
} }
m_extaddref(m, payload, blen, &clm->refcount, rxb_free, m_extaddref(m, payload, blen, &clm->refcount, rxb_free, clm,
swz->zone, sd->cl); NULL);
} else { } else {
/* /*
@ -1899,10 +1900,12 @@ get_scatter_segment(struct adapter *sc, struct sge_fl *fl, int fr_offset,
if (clm != NULL) { if (clm != NULL) {
if (sd->nmbuf++ == 0) { if (sd->nmbuf++ == 0) {
clm->refcount = 1; clm->refcount = 1;
clm->zone = swz->zone;
clm->cl = sd->cl;
counter_u64_add(extfree_refs, 1); counter_u64_add(extfree_refs, 1);
} }
m_extaddref(m, payload, blen, &clm->refcount, m_extaddref(m, payload, blen, &clm->refcount,
rxb_free, swz->zone, sd->cl); rxb_free, clm, NULL);
} else { } else {
m_cljset(m, sd->cl, swz->type); m_cljset(m, sd->cl, swz->type);
sd->cl = NULL; /* consumed, not a recycle candidate */ sd->cl = NULL; /* consumed, not a recycle candidate */