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:
Navdeep Parhar 2020-02-03 23:50:29 +00:00
parent a3f02b1af7
commit d6f79b2710
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357479
2 changed files with 11 additions and 6 deletions

View File

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

View File

@ -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 */