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

Eugene Grosbein eugen at
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
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 22 14:10:10 UTC 2012
>Originator:     Eugene Grosbein
>Release:        FreeBSD 8.3-PRERELEASE i386
System: FreeBSD 8.3-PRERELEASE


	My home router runs FreeBSD/i386 on AMD Geode:

%uname -a
FreeBSD 8.3-PRERELEASE FreeBSD 8.3-PRERELEASE #1: Tue Mar  6 23:11:20 NOVT 2012     root at  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

	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'

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


	Run "time netstat -rn"



More information about the freebsd-bugs mailing list