[Bug 272818] hv_kvp_daemon high CPU usage on Internet router

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 30 Jul 2023 23:04:41 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272818

Greg Becker <greg@codeconcepts.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greg@codeconcepts.com

--- Comment #1 from Greg Becker <greg@codeconcepts.com> ---
Presuming "hn1" is an interface (?), there's only one "default" route, and the
default route is always printed within the first few lines, then having awk
stop on the first match should kill the netstat command before it generates
very much output, which I would think would greatly reduce the CPU overhead.

But I'd have to see the output of your 'netstat -rn' command to be sure.  Worst
case, netstat does a whole lot of CPU intensive work before it starts emitting
routes, in which case curbing the output may not help much.

I didn't see any sysctl to print the default route, which would have been nice
and probably result in much less overhead than launching into netstat.  Perhaps
there is some other light-weight way in which to get the default route?

Off the top of my head, something like the following might improve things:

netstat -rn | awk -v interface=hn1 '$1 == "default" && $4 == interface {print
$2; rc=1; exit; } END{exit !rc}'

-- 
You are receiving this mail because:
You are the assignee for the bug.