Skip to content

Commit

Permalink
[PATCH] oom: swapoff tasks tweak
Browse files Browse the repository at this point in the history
PF_SWAPOFF processes currently cause select_bad_process to return straight
away.  Instead, give them high priority, so we will kill them first, however
we also first ensure no parallel OOM kills are happening at the same time.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Sep 26, 2006
1 parent 4a3ede1 commit af5b912
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mm/oom_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
return 0;
}

/*
* swapoff can easily use up all memory, so kill those first.
*/
if (p->flags & PF_SWAPOFF)
return ULONG_MAX;

/*
* The memory size of the process is the basis for the badness.
*/
Expand Down Expand Up @@ -230,8 +236,6 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
}
if (p->oomkilladj == OOM_DISABLE)
continue;
if (p->flags & PF_SWAPOFF)
return p;

points = badness(p, uptime.tv_sec);
if (points > *ppoints || !chosen) {
Expand Down

0 comments on commit af5b912

Please sign in to comment.