I've disabled memory overcommitting by setting
overcommit_memory=2. Now when I tried to
swapoff, I get this error:
swapoff: /dev/sda5: swapoff failed: Cannot allocate memory
But I in fact have
0 MiB in swap and lots of free memory! I tried setting
overcommit_ratio to 100, but it didn't change anything.
If I temporarily set
overcommit_memory=0 as is by default, I can successfully
swapoff, then re-disable overcommitting.
Why such strange behavior? Is it a bug?
EDIT as asked in comments:
$ grep -E '^Mem|Commit' /proc/meminfo MemTotal: 2044420 kB MemFree: 751836 kB CommitLimit: 4122112 kB Committed_AS: 2752544 kB