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 memoryBut 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/meminfoMemTotal:        2044420 kBMemFree:          751836 kBCommitLimit:     4122112 kBCommitted_AS:    2752544 kB
swapoff fails when overcommit_memory==2
memory;swap
As @Mat pointed out, Committed_AS > MemTotal.  In other words, you already have allocated more memory than you physically have, so if you were to disable swap, you would already be over-committed.  Thus, when you don't allow over-commit, you can not disable the swap until you free up some memory.Not all of the allocated memory is actually used, which is why you still have some free memory, despite having allocated so much.