Vm_pageout isn't aware of swap pager's status.
As a result, when a large number of pages are suddenly consumed, the number
of active pages becomes suddenly too low, also swap pager didn't
detect necessity of paging out in flush, vm_page out starts process killing
even though large number of swap space is remaining.
One of the easiest way to reproduce a case when OOM kills processes
while a large number of swap pages remaining is 'dd'ing to tmpfs.
I was able to reproduce the situation very frequently with the blow command.
Under my tests, processes were killed with 10GB of swap space remaining.
% mount -t tmpfs tmp /mnt/tmpfs
% dd if=/dev/zero of=/mnt/tmpfs/1 bs=1M
Swap_pager_full is set when there is no swap devices or when free swap
spaces are not found. Let OOM killer wait until we really run out of
This code will change the current behavior of OOM killing. As of now,
OOM killing starts happening if the system cannot create free pages
fast enough, regardless of availability of space spaces.
So, it is not full deterministic when OOM kicks in.
With this change, OOM will wait until swap spaces are fully consumed.
This may results in heavier slashing at peak of swap space usage as
OOM killing doesn't kick in.