Solved CPU usage on idle

I have two small VPS instances, one running FreeBSD and the other running Linux. The FreeBSD sits at 2% CPU usage when the system is doing literally nothing, whereas Linux instance is 0%.

Any suggestions for system tuning to get this down to 0%? From top output, the process using the most CPU time is rand harvest -- is that just churning even though the system is idle? If so, anything I can do about it? I know 2% is small, but I'd like to understand what the system is doing, and why Linux doesn't have this effect.
 
My machine does never do really "nothing", but I observed this:

By default my kernels get compiled with HZ=200 (aka sysctl kern.hz). I changed a bhyve instance to kern.hz=4000, and consequentially the idle cpu (i5-3570T) power usage changed from 19W to 26W (as shown with sysutils/intel-pcm).

Logically follows from this that even with low HZ there will be some CPU usage (maybe 2% ?).

Background: what I am focused on is dummynet(4). And dummynet is also the primary consumer of the power. To work properly, dummynet seems to need a very high HZ value. I do not know how things would be with dummynet unused (i.e. no ipfw firewall) or not compiled in.
 
Ah, that explains it. So Linux has a "CONFIG_NO_HZ_IDLE" feature, which puts the kernel into tickless mode when the system is idle. FreeBSD doesn't have that, so it's using 2% of the CPU waking itself up 1000 times per second for no reason. Anyway, thanks for the help, and marking this solved.
 
There is a reason why kern.hz is 1000.
Why is 10 not a good value for number of clock ticks per second ?
Or why is 100000 not a good value for number of clock ticks per second ?
 
There is a reason why kern.hz is 1000.
Why is 10 not a good value for number of clock ticks per second ?
Or why is 100000 not a good value for number of clock ticks per second ?
Sure -- I didn't mean to imply that there is anything wrong with the FreeBSD implementation. Just trying to figure out discrepancy between my Linux and FreeBSD instances.
 
My VPS instances at Binary Lane sit at between 99.2% and 100% idle. My VPS instance at Vultr sits between 98.1% and 100% idle.

I no longer recall which one, but one of them was always at 5% until I lodged a support ticket and they finagled something.
 
Back
Top