Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 591762 - sys-process/procps: top: memory based fields goof on >1G
Summary: sys-process/procps: top: memory based fields goof on >1G
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
Keywords: PATCH
Depends on:
Reported: 2016-08-20 21:46 UTC by Raymond Jennings
Modified: 2023-09-02 09:56 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---

emerge --info (einfo.txt,6.22 KB, text/plain)
2016-08-21 16:58 UTC, Raymond Jennings
Screenshot of top, with an orange circle highlighting the problem. (oops.png,75.96 KB, image/png)
2016-08-21 18:43 UTC, Raymond Jennings
patch (2-fix-mem-scale.patch,1.59 KB, patch)
2016-08-24 20:29 UTC, Raymond Jennings
Details | Diff
update (2-scalemem-fix.patch,1.45 KB, patch)
2016-08-24 20:38 UTC, Raymond Jennings
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Raymond Jennings 2016-08-20 21:46:09 UTC
When top is trying to print a memory based field, it looks really weird if the amount is over a few G

Instead of ##.#g, it shows as 0.0##t
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2016-08-21 10:14:53 UTC
That's short for terabytes. Try pressing `e' (for task memory scale) and `E' (for summary memory scale) a few times.

Also, please post your `emerge --info sys-process/procps' output in a comment.
Comment 2 Raymond Jennings 2016-08-21 16:58:58 UTC
Created attachment 443826 [details]
emerge --info
Comment 3 Raymond Jennings 2016-08-21 17:02:28 UTC
Pressing "e" does change the scale, but for some reason if I run a program with >10G in RSS, it comes up as 0.010t something instead of 10.XXXg.

The VIRT field however shows up fine.

It also displays fine if its <10G, so RSS of 9.XXXg shows up as expected, it just switches to terabytes if it goes over <10G, but it should only do that for over <1024G, as 10.00g instead of 0.010t

my guess is that its a reaction to the field width being unexpectedly narrower than needed.
Comment 4 Raymond Jennings 2016-08-21 17:03:14 UTC
Pressing 'e' doesn't really help much.

As a test, run a program that allocates more than 10G in RSS, and top will show it as 0.010t instead of 10.000g.
Comment 5 Raymond Jennings 2016-08-21 18:43:34 UTC
Created attachment 443834 [details]
Screenshot of top, with an orange circle highlighting the problem.

This shows the 18g vs 0.018t thing I was talking about.

Wrote a quick program to allocate and touch 18g of memory.
Comment 6 Mike Gilbert gentoo-dev 2016-08-23 01:40:18 UTC
This seems like the sort of thing you should report to the upstream developers, but to the Gentoo maintainer.
Comment 7 Mike Gilbert gentoo-dev 2016-08-23 01:40:50 UTC
(In reply to Mike Gilbert from comment #6)

Sorry, that should say "not to the Gentoo maintainer".
Comment 8 Raymond Jennings 2016-08-24 20:29:22 UTC
Created attachment 444056 [details, diff]

In the meantime, how do you guys like this patch?
Comment 9 Raymond Jennings 2016-08-24 20:38:03 UTC
Created attachment 444058 [details, diff]
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-09-02 09:56:51 UTC
DId you send it upstream?