On Mon, Oct 04, 2010 at 10:41:15PM +0000, Stuart Henderson wrote:
> On 2010-10-04, Insan Praja SW <[email protected]> wrote:
> > I can't see any livelocks. I'm aware of new algorithm on mclgeti got  
> > something to do with this, I just want to confirm this. If this systat  
> > output tells me the truth, well that just a huge achievement.
> 
> # pstat -d u mcllivelocks
> 
> You will probbaly see more livelocks than before (the detection is more
> sensitive), but the effect on network traffic should be smaller.
> 

this restores the visibility of network livelocks to systat.

anyone object? if not i'll commit it tomorrow morning around 10am
in a GMT+10 timezeon.

Index: sbin/sysctl/sysctl.c
===================================================================
RCS file: /cvs/src/sbin/sysctl/sysctl.c,v
retrieving revision 1.173
diff -u -p -r1.173 sysctl.c
--- sbin/sysctl/sysctl.c        19 Aug 2010 18:14:14 -0000      1.173
+++ sbin/sysctl/sysctl.c        5 Oct 2010 01:20:59 -0000
@@ -447,6 +447,9 @@ parse(char *string, int flags)
                case KERN_CONSDEV:
                        special |= CHRDEV;
                        break;
+               case KERN_NETLIVELOCKS:
+                       special |= UNSIGNED;
+                       break;
                }
                break;
 
Index: sys/kern/kern_sysctl.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_sysctl.c,v
retrieving revision 1.193
diff -u -p -r1.193 kern_sysctl.c
--- sys/kern/kern_sysctl.c      23 Sep 2010 13:24:22 -0000      1.193
+++ sys/kern/kern_sysctl.c      5 Oct 2010 01:21:02 -0000
@@ -110,6 +110,7 @@ extern int nselcoll, fscale;
 extern struct disklist_head disklist;
 extern fixpt_t ccpu;
 extern  long numvnodes;
+extern u_int mcllivelocks;
 
 extern void nmbclust_update(void);
 
@@ -585,6 +586,8 @@ kern_sysctl(int *name, u_int namelen, vo
                else
                        dev = NODEV;
                return sysctl_rdstruct(oldp, oldlenp, newp, &dev, sizeof(dev));
+       case KERN_NETLIVELOCKS:
+               return (sysctl_rdint(oldp, oldlenp, newp, mcllivelocks));
        default:
                return (EOPNOTSUPP);
        }
Index: sys/sys/sysctl.h
===================================================================
RCS file: /cvs/src/sys/sys/sysctl.h,v
retrieving revision 1.106
diff -u -p -r1.106 sysctl.h
--- sys/sys/sysctl.h    19 Aug 2010 18:14:13 -0000      1.106
+++ sys/sys/sysctl.h    5 Oct 2010 01:21:03 -0000
@@ -190,7 +190,8 @@ struct ctlname {
 #define        KERN_FILE2              73      /* struct: file entries */
 #define        KERN_RTHREADS           74      /* kernel rthreads support 
enabled */
 #define        KERN_CONSDEV            75      /* dev_t: console terminal 
device */
-#define        KERN_MAXID              76      /* number of valid kern ids */
+#define        KERN_NETLIVELOCKS       76      /* int: number of network 
livelocks */
+#define        KERN_MAXID              77      /* number of valid kern ids */
 
 #define        CTL_KERN_NAMES { \
        { 0, 0 }, \
@@ -269,6 +270,7 @@ struct ctlname {
        { "file2", CTLTYPE_STRUCT }, \
        { "rthreads", CTLTYPE_INT }, \
        { "consdev", CTLTYPE_STRUCT }, \
+       { "netlivelocks", CTLTYPE_INT }, \
 }
 
 /*
Index: usr.bin/systat/mbufs.c
===================================================================
RCS file: /cvs/src/usr.bin/systat/mbufs.c,v
retrieving revision 1.29
diff -u -p -r1.29 mbufs.c
--- usr.bin/systat/mbufs.c      23 Sep 2010 10:49:55 -0000      1.29
+++ usr.bin/systat/mbufs.c      5 Oct 2010 01:21:04 -0000
@@ -41,6 +41,7 @@ struct mclpool_info {
 int mclpool_count = 0;
 int mbpool_index = -1;
 struct pool mbpool;
+u_int mcllivelocks = 0;
 
 /* interfaces */
 static int num_ifs;
@@ -198,6 +199,15 @@ read_mb(void)
        int i, p, nif, ret = 1;
        size_t size;
 
+       mib[0] = CTL_KERN;
+       mib[1] = KERN_NETLIVELOCKS;
+       size = sizeof(mcllivelocks);
+       if (sysctl(mib, 2, &mcllivelocks, &size, NULL, 0) < 0 &&
+           errno != EOPNOTSUPP) {
+               error("sysctl(KERN_NETLIVELOCKS)");
+               goto exit;
+       }
+
        num_disp = 0;
        if (getifaddrs(&ifap)) {
                error("getifaddrs: %s", strerror(errno));
@@ -341,6 +351,7 @@ showmbuf(struct if_info *ifi, int p, int
                print_fld_str(FLD_MB_IFACE, ifi->name);
 
        if (p == -1 && ifi == interfaces) {
+               print_fld_uint(FLD_MB_LLOCKS, mcllivelocks);
                print_fld_size(FLD_MB_MSIZE, mbpool.pr_size);
                print_fld_size(FLD_MB_MALIVE, mbpool.pr_nget - mbpool.pr_nput);
                print_fld_size(FLD_MB_MHWM, mbpool.pr_hiwat);
@@ -349,8 +360,6 @@ showmbuf(struct if_info *ifi, int p, int
 #if NOTYET
        print_fld_uint(FLD_MB_RXDELAY, ifi->data.ifi_rxdelay);
        print_fld_uint(FLD_MB_TXDELAY, ifi->data.ifi_txdelay);
-       if (ifi->data.ifi_livelocks)
-               print_fld_size(FLD_MB_LLOCKS, ifi->data.ifi_livelocks);
 #endif
 
        if (p >= 0 && p < mclpool_count) {

Reply via email to