svn commit: r357479 - head/sys/dev/cxgbe
Navdeep Parhar
np at FreeBSD.org
Mon Feb 3 23:50:30 UTC 2020
Author: np
Date: Mon Feb 3 23:50:29 2020
New Revision: 357479
URL: https://svnweb.freebsd.org/changeset/base/357479
Log:
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
Modified:
head/sys/dev/cxgbe/adapter.h
head/sys/dev/cxgbe/t4_sge.c
Modified: head/sys/dev/cxgbe/adapter.h
==============================================================================
--- head/sys/dev/cxgbe/adapter.h Mon Feb 3 23:40:27 2020 (r357478)
+++ head/sys/dev/cxgbe/adapter.h Mon Feb 3 23:50:29 2020 (r357479)
@@ -326,6 +326,8 @@ struct cluster_layout {
};
struct cluster_metadata {
+ uma_zone_t zone;
+ caddr_t cl;
u_int refcount;
};
Modified: head/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:40:27 2020 (r357478)
+++ head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:50:29 2020 (r357479)
@@ -1804,10 +1804,9 @@ cl_metadata(struct adapter *sc, struct sge_fl *fl, str
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->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
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 */
More information about the svn-src-all
mailing list