I am trying to find out what exactly uses swap memory in my system. Free reports over 5GB of used swap memory, but all processes use only 24MB of swap. I suspect that swap might be used by a tmpfs filesystem, but I don't know how to check it.
Would you be so kind to tell what else should I check to examine content of the swap memory, please?
# free -m
total used free shared buffers cached
Mem: 48206 47688 518 8177 10 11789
-/+ buffers/cache: 35888 12317
Swap: 15999 5378 10621
VmSwap from /proc/*/status
# grep "VmSwap:" /proc/*/status | awk '{swapped+=$2} END {print swapped/1024" MB"}' 23.8438 MB # grep "VmSwap:" /proc/*/status | grep -v " 0 kB" /proc/1/status:VmSwap: 52 kB /proc/27714/status:VmSwap: 956 kB /proc/27718/status:VmSwap: 948 kB /proc/27722/status:VmSwap: 820 kB /proc/27723/status:VmSwap: 804 kB /proc/27724/status:VmSwap: 812 kB /proc/27725/status:VmSwap: 804 kB /proc/29636/status:VmSwap: 760 kB /proc/29640/status:VmSwap: 960 kB /proc/29642/status:VmSwap: 1948 kB /proc/29643/status:VmSwap: 936 kB /proc/29647/status:VmSwap: 1624 kB /proc/29649/status:VmSwap: 872 kB /proc/3750/status:VmSwap: 116 kB /proc/3770/status:VmSwap: 228 kB /proc/3790/status:VmSwap: 260 kB /proc/3810/status:VmSwap: 444 kB /proc/3823/status:VmSwap: 164 kB /proc/4022/status:VmSwap: 2296 kB /proc/4037/status:VmSwap: 640 kB /proc/4049/status:VmSwap: 572 kB /proc/4058/status:VmSwap: 592 kB /proc/4068/status:VmSwap: 260 kB /proc/4081/status:VmSwap: 192 kB /proc/4095/status:VmSwap: 56 kB /proc/4110/status:VmSwap: 76 kB /proc/4112/status:VmSwap: 80 kB /proc/4114/status:VmSwap: 76 kB /proc/4116/status:VmSwap: 80 kB /proc/4118/status:VmSwap: 80 kB /proc/4120/status:VmSwap: 76 kB /proc/4127/status:VmSwap: 2068 kB /proc/4128/status:VmSwap: 2068 kB /proc/7655/status:VmSwap: 312 kB /proc/7661/status:VmSwap: 380 kB /proc/905/status:VmSwap: 840 kB
tmpfs
# mount | grep tmpfs tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/proc/meminfo
# cat /proc/meminfo MemTotal: 49363344 kB MemFree: 700676 kB Buffers: 11000 kB Cached: 11822364 kB SwapCached: 522436 kB Active: 37945008 kB Inactive: 4986964 kB Active(anon): 35707220 kB Inactive(anon): 3720092 kB Active(file): 2237788 kB Inactive(file): 1266872 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 16383992 kB SwapFree: 10875936 kB Dirty: 224072 kB Writeback: 0 kB AnonPages: 30580752 kB Mapped: 12218972 kB Shmem: 8328572 kB Slab: 270104 kB SReclaimable: 181768 kB SUnreclaim: 88336 kB KernelStack: 4256 kB PageTables: 91528 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 41065664 kB Committed_AS: 49589524 kB VmallocTotal: 34359738367 kB VmallocUsed: 5203000 kB VmallocChunk: 34327589304 kB HardwareCorrupted: 0 kB AnonHugePages: 5289984 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 31952556 kB DirectMap2M: 17270784 kB DirectMap1G: 1048576 kB
EDIT:
Problem solved, I found an information that 1372500 pages of shared memory is swapped:
# ipcs -mu
------ Shared Memory Status --------
segments allocated 32
pages allocated 2752532
pages resident 1380020
pages swapped 1372500
Swap performance: 0 attempts 0 successes
# getconf PAGESIZE
4096
# echo $((1372500*4096/1024/1024))
5361