Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Feb 2020 23:50:29 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357479 - head/sys/dev/cxgbe
Message-ID:  <202002032350.013NoTJK029385@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002032350.013NoTJK029385>