Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Mar 2003 19:26:27 -0500
From:      Hiten Pandya <hiten@unixdaemons.com>
To:        Petri Helenius <pete@he.iki.fi>
Cc:        Bosko Milekic <bmilekic@unixdaemons.com>, freebsd-current@FreeBSD.ORG
Subject:   Re: mbuf cache
Message-ID:  <20030305002627.GC3455@unixdaemons.com>
In-Reply-To: <20030305000115.GA3455@unixdaemons.com>
References:  <0ded01c2e295$cbef0940$932a40c1@PHE> <20030304164449.A10136@unixdaemons.com> <0e1b01c2e29c$d1fefdc0$932a40c1@PHE> <20030304173809.A10373@unixdaemons.com> <0e2b01c2e2a3$96fd3b40$932a40c1@PHE> <20030304182133.A10561@unixdaemons.com> <0e3701c2e2a7$aaa2b180$932a40c1@PHE> <20030305000115.GA3455@unixdaemons.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--9amGYk9869ThD9tj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hiten Pandya (Tue, Mar 04, 2003 at 07:01:15PM -0500) wrote:
> Petri Helenius (Wed, Mar 05, 2003 at 01:42:05AM +0200) wrote:
> > >
> > >   This does look odd... maybe there's a leak somewhere... does "in use"
> > >   go back down to a much lower number eventually?  What kind of test are
> > >   you running?  "in pool" means that that's the number in the cache
> > >   while "in use" means that that's the number out of the cache
> > >   currently being used by the system; but if you're telling me that
> > >   there's no way usage could be that high while you ran the netstat,
> > >   either there's a serious leak somewhere or I got the stats wrong
> > >   (anyone else notice irregular stats?)
> > >
> > I think I figured this, the "em" driver is allocating mbuf for each receive
> > descriptor regardless if it?s needed or not. Does this cause a performance
> > issue if there is 8000 mbufs in use and we get 100k-150k frees and
> > allocates a second (for every packet?)
> > 
> > (I have the em driver configured for 4096 receive descriptors)
> 
> While you are there debugging mbuf issues, you might also want to try
> this patch:
> 

Oops, my first patch had some bugs because of quick editing.  Please try
the newer patch:

	http://www.unixdaemons.com/~hiten/work/mbuf/if_em.c.patch

Cheers.

-- 
Hiten Pandya (hiten@unixdaemons.com, hiten@uk.FreeBSD.org)
http://www.unixdaemons.com/~hiten/

--9amGYk9869ThD9tj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="if_em.c.patch"

Index: sys/dev/em/if_em.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/em/if_em.c,v
retrieving revision 1.19
diff -u -r1.19 if_em.c
--- sys/dev/em/if_em.c	19 Feb 2003 05:47:03 -0000	1.19
+++ sys/dev/em/if_em.c	5 Mar 2003 00:17:05 -0000
@@ -1802,17 +1802,11 @@
 	ifp = &adapter->interface_data.ac_if;
 
 	if (mp == NULL) {
-		MGETHDR(mp, M_DONTWAIT, MT_DATA);
+		mp = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
 		if (mp == NULL) {
 			adapter->mbuf_alloc_failed++;
 			return(ENOBUFS);
 		}
-		MCLGET(mp, M_DONTWAIT);
-		if ((mp->m_flags & M_EXT) == 0) {
-			m_freem(mp);
-			adapter->mbuf_cluster_failed++;
-			return(ENOBUFS);
-		}
 		mp->m_len = mp->m_pkthdr.len = MCLBYTES;
 	} else {
 		mp->m_len = mp->m_pkthdr.len = MCLBYTES;
@@ -2410,8 +2404,6 @@
 	       adapter->no_tx_desc_avail2);
 	printf("em%d: Std Mbuf Failed = %ld\n",unit, 
 	       adapter->mbuf_alloc_failed);
-	printf("em%d: Std Cluster Failed = %ld\n",unit, 
-	       adapter->mbuf_cluster_failed);
 
 	printf("em%d: Symbol errors = %lld\n", unit, 
 	       (long long)adapter->stats.symerrs);
Index: sys/dev/em/if_em.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/em/if_em.h,v
retrieving revision 1.12
diff -u -r1.12 if_em.h
--- sys/dev/em/if_em.h	23 Dec 2002 19:11:23 -0000	1.12
+++ sys/dev/em/if_em.h	5 Mar 2003 00:20:57 -0000
@@ -366,7 +366,6 @@
 	/* Misc stats maintained by the driver */
 	unsigned long   dropped_pkts;
 	unsigned long   mbuf_alloc_failed;
-	unsigned long   mbuf_cluster_failed;
 	unsigned long   no_tx_desc_avail1;
 	unsigned long   no_tx_desc_avail2;
 #ifdef DBG_STATS

--9amGYk9869ThD9tj--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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