]> git.hungrycats.org Git - linux/commit
[PATCH] Disallow swapoff if there is insufficient memory
authorAndrew Morton <akpm@digeo.com>
Sun, 20 Apr 2003 07:28:39 +0000 (00:28 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 20 Apr 2003 07:28:39 +0000 (00:28 -0700)
commit464f4e7893c4a88b6bdf8c241358b91d4fc79942
tree0573b5b5f4b7e8ecf1c34da46d4b1fd05e7c9396
parent36f6aa1b67f4387ef8d50ad060207df04f007ffd
[PATCH] Disallow swapoff if there is insufficient memory

From: Hugh Dickins <hugh@veritas.com>

First of three small "stop swapoff" patches based on 2.5.67-mm3:

stop swapoff 1/3 vm_enough_memory?

Before embarking upon swapoff, check vm_enough_memory.  Mainly
for consistency in the overcommit_memory 2 (strict accounting) case:
fail with -ENOMEM if it wouldn't let the amount removed be committed.

Will always succeed in the overcommit_memory 1 case, as it should in
root-shoot-foot mode.  In the overcommit_memory 0 case, well, I don't
care much either way, so opted for the simplest code: no special case.
Which means it could now fail at the start; but that's unlikely (case 0
is over-generous) and only when it would have got stuck later on anyway.
mm/swapfile.c