kern/167204: terrible "netstat -rn" performance due to slow kvm_nlist()

Eugene Grosbein eugen at grosbein.net
Sun Apr 22 14:10:11 UTC 2012


>Number:         167204
>Category:       kern
>Synopsis:       terrible "netstat -rn" performance due to slow kvm_nlist()
>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:   Sun Apr 22 14:10:10 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Eugene Grosbein
>Release:        FreeBSD 8.3-PRERELEASE i386
>Organization:
RDTC JSC
>Environment:
System: FreeBSD grosbein.pp.ru 8.3-PRERELEASE

>Description:

	My home router runs FreeBSD/i386 on AMD Geode:

%uname -a
FreeBSD gw.grosbein.pp.ru 8.3-PRERELEASE FreeBSD 8.3-PRERELEASE #1: Tue Mar  6 23:11:20 NOVT 2012     root at grosbein.pp.ru:/usr/local/obj/nanobsd.gw/i386/usr/local/src/sys/GW  i386
%grep CPU /var/run/dmesg.boot
CPU: Geode(TM) Integrated Processor by AMD PCS (499.91-MHz 586-class CPU)

	It has no IPv6 in the kernel config and pretty small routing table:

%sh -c 'time netstat -rn | wc -l'
        1.47 real         0.00 user         1.06 sys
      30

	As you can see, it takes more than a second
	for 'netstat -rn' to complete.

	Most of time it spends calling kldsym() system call
	from kvm_nlist() function:

%kdump | fgrep -c 'CALL  kldsym(0,KLDSYM_LOOKUP'
347

	For some unknown reason, the performace of this syscall is way too bad.

>How-To-Repeat:

	Run "time netstat -rn"

>Fix:

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


More information about the freebsd-bugs mailing list