Menu

#2890 hrSWRunEntry, don't list kernel threads (new configuration knob ?)

freeBSD
closed
None
3
2018-12-28
2018-09-30
Ben RUBSON
No

Hi,

As explained and first reported here :
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231732

When browsing hrSWRunEntry (1.3.6.1.2.1.25.4.2.1) on FreeBSD servers, many "kernel" processes are returned.
I have servers with around 100 user processes, and 1000 kernel threads, making hrSWRunEntry SNMP requests very slow.

KVM_GETPROCS(3) helped me to find the following solution :
I replaced KERN_PROC_ALL by KERN_PROC_PROC in kvm_getprocs() calls.

hrSWRunEntry requests now take around 0.5 second instead of sometimes more than 20 !

Could we then think about disabling kernel threads in hrSWRunEntry ?
I see no reason to keep them ?
Perhaps adding a new configuration (or compilation ?) option ?

Thank you very much !

Ben

Discussion

  • Bart Van Assche

    Bart Van Assche - 2018-09-30

    Can you share your changes, e.g. by posting here the output of git diff?

     
  • Ben RUBSON

    Ben RUBSON - 2018-10-01

    Sure, here it is :

    --- net-snmp-5.7.3/agent/mibgroup/host/data_access/swrun_kinfo.c.orig   2014-12-08 21:23:22.000000000 +0100
    +++ net-snmp-5.7.3/agent/mibgroup/host/data_access/swrun_kinfo.c    2018-10-01 13:13:25.218415000 +0200
    @@ -189,7 +189,7 @@
     #elif defined(HAVE_KVM_GETPROC2)
         proc_table = kvm_getproc2(kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), &nprocs );
     #else
    
    -    proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nprocs );
    +    proc_table = kvm_getprocs(kd, KERN_PROC_PROC, 0, &nprocs );
     #endif
         for ( i=0 ; i<nprocs; i++ ) {
             if ( 0 == proc_table[i].SWRUN_K_STAT )
    

    There are some other kvm_getproc[2s](.*, KERN_PROC_ALL, .*) calls in the code, but the above one seems to be the one triggered by hrSWRunEntry SNMP requests.

     
  • Ben RUBSON

    Ben RUBSON - 2018-12-23

    May I ask you some news regarding this Bart ?
    Many thanks !

     
  • Bart Van Assche

    Bart Van Assche - 2018-12-28

    This patch has been applied on the v5.8 and master branches. Sorry for the delay.

     
  • Bart Van Assche

    Bart Van Assche - 2018-12-28
    • status: open --> closed
    • assigned_to: bart
     
  • Ben RUBSON

    Ben RUBSON - 2018-12-28

    Don't worry, perfect, thank you very much Bart !

     

Log in to post a comment.

MongoDB Logo MongoDB