kern/134231: performance issue

Michel Henaut michel.henaut at everyware.ch
Tue May 5 13:20:03 UTC 2009


>Number:         134231
>Category:       kern
>Synopsis:       performance issue
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 05 13:20:02 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Michel Henaut
>Release:        5.5,6.2,6.3,6.4,7.0,7.1,7.2
>Organization:
everyware ltd
>Environment:
FreeBSD freebsd72-64.local 7.2-RELEASE FreeBSD 7.2-RELEASE
>Description:
We have an application (server statistics), which uses sysctl and kvm_read. We
discovered that the Cpu use of our collector increased by 80% between 6.2 and
7.2. A small test program calling 10'000 sysctl gives the following result:
6.2:
real    0m2.098s
user    0m0.000s
sys     0m2.073s
7.0:
real    0m4.352s
user    0m0.036s
sys     0m4.119s 
Do you plan another way to get a sysctl resource other than the full scan done
in the different sysctl_find_oid. (use of tree instead of linked list).

regards
>How-To-Repeat:
#include <stdio.h>
#include <sys/types.h>
#include <sys/sysctl.h>
int main()
{
   int mib[4], st, nprocs;
   size_t size;
   int temp_op;
   int op = KERN_PROC_ALL;
   int arg = 0;
   int i;
   mib[0] = CTL_KERN;
   mib[1] = KERN_PROC;
   mib[2] = op;
   mib[3] = arg;
   temp_op = op & ~KERN_PROC_INC_THREAD;
   for (i = 0; i < 10000; i++) {
   st = sysctl(mib, 3, NULL, &size, NULL, 0);
   if (st == -1) {
      fprintf(stderr, "sysctl error\n");
      exit(1);
   }
   }
   exit(0);
}

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list