Created attachment 187351 [details] top displays Total up to swap_maxpages Top's "Swap Total" is the sum of all swap spaces and not the maximum of a system can handle. Especially when gap is large, system starts killing tasks even if top displays large swap space still available. People use top to monitor system activities and amount exceeding usable space is confusing. The patch reduces to the system maximum when total swap space is more than the system can handle. In addition, the patch grabs pagesize() only once to reduce extra calls.
A commit references this bug: Author: kib Date: Wed Oct 25 11:44:47 UTC 2017 New revision: 324972 URL: https://svnweb.freebsd.org/changeset/base/324972 Log: Limit top display of total swap size by the max swap size system can handle. Keep both pagesize and the new swap_maxpages in the static variables to save sysctl calls. Submitted by: ota@j.email.ne.jp PR: 223149 MFC after: 2 weeks Changes: head/usr.bin/top/machine.c
A commit references this bug: Author: kib Date: Wed Nov 8 11:47:00 UTC 2017 New revision: 325545 URL: https://svnweb.freebsd.org/changeset/base/325545 Log: MFC r324972: Tweaks to the top swap size calculations. PR: 223149 Changes: _U stable/11/ stable/11/usr.bin/top/machine.c