I am really puzzled to understand the output of swap -l, swap -s and memory usages reflected by top command.

Hence I am not able to finalize that how much SWAP, how much physical memory are used, and how much are free and whether I have to raise memory addition request to sysadmin or not?

Below are the output from my system:

$ swap -l
swapfile             dev  swaplo blocks   free
/dev/zvol/dsk/rpool/swap 181,1       8 33554424 **33554424**

$ swap -s
total: 23539804k bytes allocated + 1608016k reserved = **25147820k** used, **10397840k** available

$ prtconf |grep -i Memory
Memory size: 49144 Megabytes
$ top -d 2 -n 2
load averages:  1.36,  1.39,  1.40    19:07:42
120 processes: 118 sleeping, 1 stopped, 1 on cpu

Memory: 48G real, **1411M** free, 24G swap in use, **10G** swap free

Below are the uname and memstat details.

Does it mean we should not look into top at all? And report memory usages in the basis of memstat only?

why swap -l and swap -s are not havign similar stat?

bash-3.2$ uname -a SunOS l28sdp1a 5.10 Generic_150401-03 i86pc i386 i86pc

=================Memstat====================== Page Summary Pages MB %Tot ------------ ---------------- ---------------- ---- Kernel 1602713 6260 13% ZFS File Data 4345496 16974 35% Anon 4974599 19432 40% Exec and libs 32588 127 0% Page cache 948627 3705 8% Free (cachelist) 972 3 0% Free (freelist) 673589 2631 5%

Total 12578584 49135 Physical 12250367 47852

Please help me to undestand.

  • Blocks != (kilo)bytes. And for the human-readable tallies (e. g. 1411M), it depends on whether the author of the tool is dividing Kilobytes by 1,000 or 1,024. Is one megabyte 1,024 bytes * 1,024; or 1,024 bytes * 1,000; or just 1,000,000 bytes? Is a Gigabyte 1,024 bytes * ( 1,024 * 1,024 ); or 1,024b * (1,024 * 1,000); or 1024b * (1,000 * 1,000); or just 1,000,000,000 bytes? – DopeGhoti Oct 21 '16 at 18:25

As the tag is Solaris I assume you are running Solaris. As a ex-Solaris admin, I really do not like to have top installed as it is misleading when reporting swap usage vs memory usage. Solaris uses the concept of virtual memory that mixes swap and memory. Although you have a swap device, swap might be allocated in memory if there is plenty available. If you trully want to find out exactly how much swap your system is using it will be a time-consuming job. This is possible by using pmap -x on each process and check the swap part.

If you are running a single application on the system then your sys admin should be able to execute echo "::memstat"|mdb -l. This will provide the current memory status and I expect they should have some monitoring in place checks the memory.

Ifyou applicaton is not the only inthe server and it is running under a specific user id you can do ps -u to provide how much it is consuming.

Hoep this helps

| improve this answer | |
  • SunOS l28sdp1a 5.10 Generic_150401-03 i86pc i386 i86pc – Amit Srivastava Oct 25 '16 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.