Bug 223149 - [patch] top displays total swap size exceeds the maximum system can handle
Summary: [patch] top displays total swap size exceeds the maximum system can handle
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-10-21 17:40 UTC by ota
Modified: 2017-11-08 11:47 UTC (History)
2 users (show)

See Also:


Attachments
top displays Total up to swap_maxpages (941 bytes, patch)
2017-10-21 17:40 UTC, ota
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ota 2017-10-21 17:40:04 UTC
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.
Comment 1 commit-hook freebsd_committer freebsd_triage 2017-10-25 11:45:33 UTC
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
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-11-08 11:47:14 UTC
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