ACK! that last diff got linewrapped somewhere in transit. Try this one... ----- The attached patch is against 2.4.1 and incorporates the following: - More optimistic OOM checking, and slightly improved OOM-kill algorithm, as per my previous patch. - Accounting of reserved memory, allowing for... - Non-overcommittal of memory if sysctl_overcommit_memory < 0, enforced even for root if < -1 (as per old non-overcommittal patch for 2.3.99, but fixed). - Behaviour when sysctl_overcommit_memory == 0 or 1 is as per my original patch (eg. soft-limited overcommittal and full overcommittal respectively). Defaults to -1. - If a process is larger than 4 times the free VM on the system, it is not allowed to allocate or reserve any more, unless overcomittal is allowed as above. Note that root may have less privilege to hog memory when sysctl_overcommit_memory == 0 than when == -1. - As part of the above, a new function vm_invalidate_totalmem() is available which should be called whenever the total amount of VM changes - at the moment this is done in sys_swap{on,off}(). This is to avoid having to recalculate the amount of available memory and swap whenever an allocation is needed. If someone knows a better way, let me know.