Bug 1034466

Summary: top utility displays memory in KiB instead of MiB
Product: Red Hat Enterprise Linux 7 Reporter: Ben England <bengland>
Component: procps-ngAssignee: Jan Rybar <jrybar>
Status: CLOSED NOTABUG QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: bengland, bnater, kdudka, perfbz, rvokal
Target Milestone: rcKeywords: FutureFeature, Upstream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-14 08:05:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ben England 2013-11-25 22:02:50 UTC
Description of problem:

The /usr/bin/top utility displays memory in lines 4 and 5 on screen in units of kilobytes, this is silly, and it overflows if server has 128 GB RAM.  Why not display it in megabytes, this would make display more readable and compact.  If people really want to know how many KB are available, they can read /proc/meminfo

Version-Release number of selected component (if applicable):

RPM version procps-ng-3.3.8-15.el7.x86_64

How reproducible:

Every time

Steps to Reproduce:
1.  Find server with 128 GB RAM
2.  run /usr/bin/top on it

Actual results:

KiB Mem:  13198875+total,  2453360 used, 12953539+free,     2404 buffers
KiB Swap:  4194300 total,        0 used,  4194300 free,   947368 cached

Expected results:

MiB Mem: 131072 total,   nnnnn used, 131072-nnnnn free
and so on

Comment 2 Jaromír Cápík 2013-11-26 13:01:19 UTC
Hello Ben.

The unit is configurable with [Shift]+[E] and you can write the configuration with [Shift]+[W].

You can switch between KiB, MiB, GiB, TiB, PiB and EiB.

NOTE: You can also switch the column units by pressing [e].

Please, let me know if that satisfies your needs.

Thank you.

Regards,
Jaromir.

Comment 3 Ben England 2013-11-30 14:47:13 UTC
First of all, it really isn't a question of whether it satisfies my needs.   The question is whether the default unit (KiB) satisfies the average user's needs.  

It's nice that you can reconfigure it to a better unit, but that is almost irrelevant -- IMHO it should be a goal for all software should work without reconfiguration in most cases.    Since it is reconfigurable, there is even less reason to hang onto the old default of KiB, since the few people who need the unit of kilobytes can still use it.  An increasing number of server configs will have > 100 GB RAM, and a decreasing number (zero?) will have < 10 MB RAM.  So I'm trying to propose the simplest solution for the developer.

Also, the display is just wrong when it is in units of KiB, see above.  Perhaps the unit of KiB should be disabled when the field is overflowing?

Comment 4 Jaromír Cápík 2014-03-20 12:46:16 UTC
Hello Ben.

Please, propose the changes upstream. The 'top' tool is maintained by Jim Warner and I'm willing to backport the change once it appears in the upstream repository.

Thank you,
Jaromir.

Comment 8 Jan Rybar 2017-03-13 13:04:39 UTC
Upstream plans to cover this issue in one of the next versions of the software.
https://gitlab.com/procps-ng/procps/issues/50

When it is ready, a backport patch can be expected.

Comment 14 Jan Rybar 2017-09-13 14:56:55 UTC
Ben, if you like, you can simply create your own configuration the way you propose.

1. run top
2. press 'e' (to scale memory in Task Area to MiB)
3. press 'E' (to scale memory in Summary Area to MiB)
4. press 'W' to create/rewrite your own ~/.toprc file (Section 6b in top's manpage)

Next time you run top, your configs will be loaded.

You can also add colors by pressing 'z', "tree" tasks by pressing 'V' and add usage bars by pressing 't' for CPUs and 'm' for memory repeatedly to your liking.
This is, by the way, the look of "modern top".
Again, save the changes by hitting 'W'.

Cheers,

Jan

Comment 15 Ben England 2017-09-13 17:46:29 UTC
ok, I surrender ;-) I didn't realize that you could persist the settings or change the defaults (by copying the config file).  Anyway, as you said I think the default should change in the next major release.

Comment 16 Jan Rybar 2017-09-14 08:09:04 UTC
(In reply to Ben England from comment #15)
> ok, I surrender ;-) I didn't realize that you could persist the settings or
> change the defaults (by copying the config file).  Anyway, as you said I
> think the default should change in the next major release.

Agreed :)
Working on it.