1 From stable-bounces@linux.kernel.org Fri Jan 5 16:57:46 2007
2 Message-Id: <200701060037.l060bUhd013413@shell0.pdx.osdl.net>
5 Date: Fri, 05 Jan 2007 16:37:03 -0800
6 Cc: akpm@osdl.org, hugh@veritas.com, stable@kernel.org
7 Subject: fix OOM killing of swapoff
9 From: Hugh Dickins <hugh@veritas.com>
11 These days, if you swapoff when there isn't enough memory, OOM killer gives
12 "BUG: scheduling while atomic" and the machine hangs: badness() needs to do
13 its PF_SWAPOFF return after the task_unlock (tasklist_lock is also held
14 here, so p isn't going to be freed: PF_SWAPOFF might get turned off at any
15 moment, but that doesn't really matter).
17 Signed-off-by: Hugh Dickins <hugh@veritas.com>
18 Cc: <stable@kernel.org>
19 Signed-off-by: Andrew Morton <akpm@osdl.org>
20 Signed-off-by: Chris Wright <chrisw@sous-sol.org>
23 mm/oom_kill.c | 12 ++++++------
24 1 file changed, 6 insertions(+), 6 deletions(-)
26 --- linux-2.6.19.1.orig/mm/oom_kill.c
27 +++ linux-2.6.19.1/mm/oom_kill.c
28 @@ -61,12 +61,6 @@ unsigned long badness(struct task_struct
32 - * swapoff can easily use up all memory, so kill those first.
34 - if (p->flags & PF_SWAPOFF)
38 * The memory size of the process is the basis for the badness.
40 points = mm->total_vm;
41 @@ -77,6 +71,12 @@ unsigned long badness(struct task_struct
45 + * swapoff can easily use up all memory, so kill those first.
47 + if (p->flags & PF_SWAPOFF)
51 * Processes which fork a lot of child processes are likely
52 * a good choice. We add half the vmsize of the children if they
53 * have an own mm. This prevents forking servers to flood the