Subject: Re: Patch to make upper-layer network protocols align as needed
To: None <tech-net@netbsd.org>
From: Tomas Svensson <ts@unix1.net>
List: tech-net
Date: 05/15/2002 02:13:03
DR> Hmmm, maybe there should be a single structure which holds all of the mbuf
DR> statistic counters rather than having MPFail, MSFail, etc.  Then we could
DR> make that available via sysctl too...maybe I should come back with a patch
DR> for that ?

Speaking of mbuf statistics, how about adding a pr_peak to keep a peak
count of pool allocations? It can be used for more info in netstat
and vmstat...

-Tomas

Index: pool.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/pool.h,v
retrieving revision 1.37
diff -u -r1.37 pool.h
--- pool.h      2002/03/13 10:57:19     1.37
+++ pool.h      2002/04/15 08:50:14
@@ -182,6 +182,7 @@
        unsigned long   pr_npagefree;   /* # of pages released */
        unsigned int    pr_hiwat;       /* max # of pages in pool */
        unsigned long   pr_nidle;       /* # of idle pages */
+       unsigned int    pr_peak;        /* max # of items allocated */
 
        /*
         * Diagnostic aides.
Index: subr_pool.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/subr_pool.c,v
retrieving revision 1.76
diff -u -r1.76 subr_pool.c
--- subr_pool.c 2002/03/13 10:57:18     1.76
+++ subr_pool.c 2002/04/15 08:51:05
@@ -496,6 +496,7 @@
        pp->pr_npagefree = 0;
        pp->pr_hiwat = 0;
        pp->pr_nidle = 0;
+       pp->pr_peak = 0;
 
 #ifdef POOL_DIAGNOSTIC
        if (flags & PR_LOGGING) {
@@ -807,7 +808,8 @@
         */
        TAILQ_REMOVE(&ph->ph_itemlist, pi, pi_list);
        pp->pr_nitems--;
-       pp->pr_nout++;
+       if (++pp->pr_nout > pp->pr_peak)
+               pp->pr_peak = pp->pr_nout;
        if (ph->ph_nmissing == 0) {
 #ifdef DIAGNOSTIC
                if (__predict_false(pp->pr_nidle == 0))