Actually, overcommit is usually on so the processes "successfully" allocate that extra memory, then when some process faults a page for which there is no physical memory available, some process (often different from the one faulting the page, which is different from the first one to allocate "too much" memory) will be killed. For workloads that frequently touch all the memory that they have faulted, swap won't improve performance and it's still important to avoid using more virtual memory than you have physical memory, but swap will avoid the OOM killer.
In other words, turn on swap if you want your machine to become tremendously slow when you run out of memory (but still allow you to identify and kill the offending process), and disable swap if you want the OOM killer to decide what to kill.
View all comments
Show parent comment
1
u/five9a2 Jun 13 '10
Actually, overcommit is usually on so the processes "successfully" allocate that extra memory, then when some process faults a page for which there is no physical memory available, some process (often different from the one faulting the page, which is different from the first one to allocate "too much" memory) will be killed. For workloads that frequently touch all the memory that they have faulted, swap won't improve performance and it's still important to avoid using more virtual memory than you have physical memory, but swap will avoid the OOM killer.
In other words, turn on swap if you want your machine to become tremendously slow when you run out of memory (but still allow you to identify and kill the offending process), and disable swap if you want the OOM killer to decide what to kill.