diff options
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r-- | mm/oom_kill.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index da4c342f2641..630b77fe862f 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -58,6 +58,10 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) | |||
58 | unsigned long points, cpu_time, run_time; | 58 | unsigned long points, cpu_time, run_time; |
59 | struct mm_struct *mm; | 59 | struct mm_struct *mm; |
60 | struct task_struct *child; | 60 | struct task_struct *child; |
61 | int oom_adj = p->signal->oom_adj; | ||
62 | |||
63 | if (oom_adj == OOM_DISABLE) | ||
64 | return 0; | ||
61 | 65 | ||
62 | task_lock(p); | 66 | task_lock(p); |
63 | mm = p->mm; | 67 | mm = p->mm; |
@@ -148,15 +152,15 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) | |||
148 | points /= 8; | 152 | points /= 8; |
149 | 153 | ||
150 | /* | 154 | /* |
151 | * Adjust the score by oomkilladj. | 155 | * Adjust the score by oom_adj. |
152 | */ | 156 | */ |
153 | if (p->oomkilladj) { | 157 | if (oom_adj) { |
154 | if (p->oomkilladj > 0) { | 158 | if (oom_adj > 0) { |
155 | if (!points) | 159 | if (!points) |
156 | points = 1; | 160 | points = 1; |
157 | points <<= p->oomkilladj; | 161 | points <<= oom_adj; |
158 | } else | 162 | } else |
159 | points >>= -(p->oomkilladj); | 163 | points >>= -(oom_adj); |
160 | } | 164 | } |
161 | 165 | ||
162 | #ifdef DEBUG | 166 | #ifdef DEBUG |
@@ -251,7 +255,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints, | |||
251 | *ppoints = ULONG_MAX; | 255 | *ppoints = ULONG_MAX; |
252 | } | 256 | } |
253 | 257 | ||
254 | if (p->oomkilladj == OOM_DISABLE) | 258 | if (p->signal->oom_adj == OOM_DISABLE) |
255 | continue; | 259 | continue; |
256 | 260 | ||
257 | points = badness(p, uptime.tv_sec); | 261 | points = badness(p, uptime.tv_sec); |
@@ -304,7 +308,7 @@ static void dump_tasks(const struct mem_cgroup *mem) | |||
304 | } | 308 | } |
305 | printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3d %3d %s\n", | 309 | printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3d %3d %s\n", |
306 | p->pid, __task_cred(p)->uid, p->tgid, mm->total_vm, | 310 | p->pid, __task_cred(p)->uid, p->tgid, mm->total_vm, |
307 | get_mm_rss(mm), (int)task_cpu(p), p->oomkilladj, | 311 | get_mm_rss(mm), (int)task_cpu(p), p->signal->oom_adj, |
308 | p->comm); | 312 | p->comm); |
309 | task_unlock(p); | 313 | task_unlock(p); |
310 | } while_each_thread(g, p); | 314 | } while_each_thread(g, p); |
@@ -359,18 +363,9 @@ static int oom_kill_task(struct task_struct *p) | |||
359 | * change to NULL at any time since we do not hold task_lock(p). | 363 | * change to NULL at any time since we do not hold task_lock(p). |
360 | * However, this is of no concern to us. | 364 | * However, this is of no concern to us. |
361 | */ | 365 | */ |
362 | 366 | if (!mm || p->signal->oom_adj == OOM_DISABLE) | |
363 | if (mm == NULL) | ||
364 | return 1; | 367 | return 1; |
365 | 368 | ||
366 | /* | ||
367 | * Don't kill the process if any threads are set to OOM_DISABLE | ||
368 | */ | ||
369 | do_each_thread(g, q) { | ||
370 | if (q->mm == mm && q->oomkilladj == OOM_DISABLE) | ||
371 | return 1; | ||
372 | } while_each_thread(g, q); | ||
373 | |||
374 | __oom_kill_task(p, 1); | 369 | __oom_kill_task(p, 1); |
375 | 370 | ||
376 | /* | 371 | /* |
@@ -394,8 +389,9 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, | |||
394 | 389 | ||
395 | if (printk_ratelimit()) { | 390 | if (printk_ratelimit()) { |
396 | printk(KERN_WARNING "%s invoked oom-killer: " | 391 | printk(KERN_WARNING "%s invoked oom-killer: " |
397 | "gfp_mask=0x%x, order=%d, oomkilladj=%d\n", | 392 | "gfp_mask=0x%x, order=%d, oom_adj=%d\n", |
398 | current->comm, gfp_mask, order, current->oomkilladj); | 393 | current->comm, gfp_mask, order, |
394 | current->signal->oom_adj); | ||
399 | task_lock(current); | 395 | task_lock(current); |
400 | cpuset_print_task_mems_allowed(current); | 396 | cpuset_print_task_mems_allowed(current); |
401 | task_unlock(current); | 397 | task_unlock(current); |