0

I have 8 GB RAM and a 8 GB swap partition and I set vm.swappiness to 90 in /etc/sysctl.conf (and verified that it's used with the sysctl command at runtime). The system uses 50 % of RAM and 40 % of swap and this situation is approximately the same after running sudo swapoff -a && sudo swapon -a and a delay of minutes. Also I see that swapping of ca. 100 MB occurs regularily at runtime.

I don't understand why the memory isn't filled up to 90 % as suggested by vm.swappiness.

I experienced with issue with Linux 4.4.0-22 and 4.5.7 on Ubuntu 16.04.

$ cat /proc/meminfo 
MemTotal:        8030020 kB
MemFree:          220724 kB
MemAvailable:    4418060 kB
Buffers:           86456 kB
Cached:          4090160 kB
SwapCached:       184660 kB
Active:          3779408 kB
Inactive:        2730596 kB
Active(anon):    1736480 kB
Inactive(anon):   955376 kB
Active(file):    2042928 kB
Inactive(file):  1775220 kB
Unevictable:       62848 kB
Mlocked:           62848 kB
SwapTotal:       8462332 kB
SwapFree:        5576576 kB
Dirty:             40332 kB
Writeback:             0 kB
AnonPages:       2312568 kB
Mapped:           315084 kB
Shmem:            351016 kB
Slab:            1039608 kB
SReclaimable:     937796 kB
SUnreclaim:       101812 kB
KernelStack:       15744 kB
PageTables:        53896 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    12477340 kB
Committed_AS:   10436316 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
HardwareCorrupted:     0 kB
AnonHugePages:    448512 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      369540 kB
DirectMap2M:     7874560 kB
Kalle Richter
  • 6,180
  • 21
  • 70
  • 103
  • 2
    I'm not a pro but if I understood right you want to use only the ram until it reaches 90% and then use the swap partition. Then you must set swappiness to 10 (the lower the swappiness the less swap will be used, I'm not sure how exactly it works since swappiness 100 doesn't mean that ram won't be used). – Thanos Apostolou Jun 12 '16 at 15:31
  • swappiness determines whether to swap or not. Setting it to 90 means it will want to swap instead of keeping it in ram. You should really just leave it at the default which is 60 which is tried and tested for most use-cases on the desktop. Read this for details... https://en.wikipedia.org/wiki/Swappiness – DanglingPointer Jun 12 '16 at 17:29

0 Answers0