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 ([EMAIL PROTECTED], [EMAIL PROTECTED])
http://www.unixdaemons.com/~hiten/
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

Reply via email to