Correctly measure system load averages > 1024
authorAlan Somers <asomers@FreeBSD.org>
Thu, 5 May 2022 21:35:23 +0000 (15:35 -0600)
committerAlan Somers <asomers@FreeBSD.org>
Fri, 6 May 2022 23:25:43 +0000 (17:25 -0600)
commit1d2421ad8b6d508ef155752bdfc5948f7373bac3
tree5f3230e5c053fa48b4ec682f1fa4df233b8b7fa7
parent90161e72eecd463919898b4e9c1e29dbeabe139d
Correctly measure system load averages > 1024

The old fixed-point arithmetic used for calculating load averages had an
overflow at 1024.  So on systems with extremely high load, the observed
load average would actually fall back to 0 and shoot up again, creating
a kind of sawtooth graph.

Fix this by using 64-bit math internally, while still reporting the load
average to userspace as a 32-bit number.

Sponsored by: Axcient
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D35134
sys/kern/kern_synch.c
sys/kern/tty_info.c
sys/sys/param.h