hishamhm / htop

htop is an interactive text-mode process viewer for Unix systems. It aims to be a better 'top'.
GNU General Public License v2.0
5.83k stars 581 forks source link

illumos: memory info is not zone aware #978

Open bahamat opened 4 years ago

bahamat commented 4 years ago

After htop 2.2 the memory information displayed in non-global zones shows the physical memory capacity instead of the zone's memory cap.

In zone memory stats should first come from the memory_cap kstat, and only display physical memory if the zone is uncapped.

bahamat commented 4 years ago

Here's an example of the kstat output

[root@962bc668 ~]# kstat -p memory_cap
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:anon_alloc_fail    0
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:anonpgin   1
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:class      zone_memory_cap
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:crtime     10873164.522118092
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:execpgin   821
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:fspgin     891
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:nover      0
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:pagedout   0
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:pgpgin     1713
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:physcap    17179869184
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:rss        63193088
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:snaptime   46219261.755143285
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:swap       70828032
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:swapcap    68719476736
memory_cap:28:962bc668-09d5-c087-b16f-d5aa6e:zonename   962bc668-09d5-c087-b16f-d5aa6e88d042

For the meminfo display within a zone, we're really only concerned with rss over physcap. You can see an example of how we do this with CMON here: https://github.com/joyent/triton-cmon-agent/blob/master/lib/instrumenter/collectors-vm/memcap.js#L17-L56

papertigers commented 4 years ago

Take a look at #876 There are some changes here but it's still not the old behavior.

papertigers commented 4 years ago

@bahamat we should also confirm that the kstat you show above is the same as what's in illumos-gate and not specific to illumos-joyent