0

Output below is meminfo from a Proxmox hypervisor. I noticed today that swap usage was 90%. I logged into the box and checked and and it seems there is actually 24G of inactive RAM. A couple minutes later, I noticed swap usage was at 99%. enter image description here

Why does the kernel appear to be favoring disk swap when there is so much inactive RAM available (EDIT: added vmstat -s below)?

# cat /proc/meminfo 
MemTotal:       131911836 kB
MemFree:        28128112 kB
MemAvailable:   51794976 kB
Buffers:          397876 kB
Cached:         23298352 kB
SwapCached:       509796 kB
Active:         73136224 kB
Inactive:       24833836 kB
Active(anon):   72432368 kB
Inactive(anon):  2030612 kB
Active(file):     703856 kB
Inactive(file): 22803224 kB
Unevictable:       20256 kB
Mlocked:           20260 kB
SwapTotal:       8388604 kB
SwapFree:          76592 kB
Dirty:               216 kB
Writeback:             0 kB
AnonPages:      73881564 kB
Mapped:           196212 kB
Shmem:            182376 kB
Slab:            3837772 kB
SReclaimable:    1413588 kB
SUnreclaim:      2424184 kB
KernelStack:       10608 kB
PageTables:       281164 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    74344520 kB
Committed_AS:   265844288 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
HardwareCorrupted:     0 kB
AnonHugePages:   2787328 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:     3584964 kB
DirectMap2M:    118982656 kB
DirectMap1G:    13631488 kB

vmstat -s

    131911840 K total memory
     85913712 K used memory
     80380944 K active memory
     24732132 K inactive memory
     20989356 K free memory
       405840 K buffer memory
     24602928 K swap cache
      8388604 K total swap
      8311256 K used swap
        77348 K free swap
     62711183 non-nice user cpu ticks
       711584 nice user cpu ticks
     19418784 system cpu ticks
   2202190185 idle cpu ticks
     12801599 IO-wait cpu ticks
            0 IRQ cpu ticks
       583222 softirq cpu ticks
            0 stolen cpu ticks
  11537252613 pages paged in
   3575771252 pages paged out
      1581238 pages swapped in
      3670384 pages swapped out
   3388189898 interrupts
   3739302263 CPU context switches
   1535799398 boot time
      3674458 forks
Server Fault
  • 3,454
  • 7
  • 48
  • 88
  • What is the value of kernel swappiness ? `sysctl -a | grep vm.swappiness` – João Alves Sep 12 '18 at 14:28
  • Thanks for the suggestion. Was set to 60. Turning it down to 40. I'll run it a few days that way and see if things improve. Could be I just need to add RAM. – Server Fault Sep 12 '18 at 14:54
  • Was your system using memory earlier, requiring the temporary usage of swap? – Michael Hampton Sep 12 '18 at 16:05
  • We run dumps (with compression) of the virtual machines from 1am to 3am which may be causing a fair amount of memory pressure. I have graphs from `sysstat` output but it looks like swap is consistently full on a daily basis. Looking for a way to tell it to empty swap so I can see exactly when it starts filling up again but the dumps are suspect. – Server Fault Sep 12 '18 at 17:20

0 Answers0