aboutsummaryrefslogtreecommitdiffstats
path: root/mm/oom_kill.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r--mm/oom_kill.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index a64decb5b13f..824cade07827 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -212,7 +212,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
212 if (!p->mm) 212 if (!p->mm)
213 continue; 213 continue;
214 /* skip the init task */ 214 /* skip the init task */
215 if (is_init(p)) 215 if (is_global_init(p))
216 continue; 216 continue;
217 217
218 /* 218 /*
@@ -265,7 +265,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
265 */ 265 */
266static void __oom_kill_task(struct task_struct *p, int verbose) 266static void __oom_kill_task(struct task_struct *p, int verbose)
267{ 267{
268 if (is_init(p)) { 268 if (is_global_init(p)) {
269 WARN_ON(1); 269 WARN_ON(1);
270 printk(KERN_WARNING "tried to kill init!\n"); 270 printk(KERN_WARNING "tried to kill init!\n");
271 return; 271 return;
@@ -278,7 +278,8 @@ static void __oom_kill_task(struct task_struct *p, int verbose)
278 } 278 }
279 279
280 if (verbose) 280 if (verbose)
281 printk(KERN_ERR "Killed process %d (%s)\n", p->pid, p->comm); 281 printk(KERN_ERR "Killed process %d (%s)\n",
282 task_pid_nr(p), p->comm);
282 283
283 /* 284 /*
284 * We give our sacrificial lamb high priority and access to 285 * We give our sacrificial lamb high priority and access to
@@ -326,7 +327,7 @@ static int oom_kill_task(struct task_struct *p)
326 * to memory reserves though, otherwise we might deplete all memory. 327 * to memory reserves though, otherwise we might deplete all memory.
327 */ 328 */
328 do_each_thread(g, q) { 329 do_each_thread(g, q) {
329 if (q->mm == mm && q->tgid != p->tgid) 330 if (q->mm == mm && !same_thread_group(q, p))
330 force_sig(SIGKILL, q); 331 force_sig(SIGKILL, q);
331 } while_each_thread(g, q); 332 } while_each_thread(g, q);
332 333
@@ -337,7 +338,6 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
337 unsigned long points, const char *message) 338 unsigned long points, const char *message)
338{ 339{
339 struct task_struct *c; 340 struct task_struct *c;
340 struct list_head *tsk;
341 341
342 if (printk_ratelimit()) { 342 if (printk_ratelimit()) {
343 printk(KERN_WARNING "%s invoked oom-killer: " 343 printk(KERN_WARNING "%s invoked oom-killer: "
@@ -357,11 +357,10 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
357 } 357 }
358 358
359 printk(KERN_ERR "%s: kill process %d (%s) score %li or a child\n", 359 printk(KERN_ERR "%s: kill process %d (%s) score %li or a child\n",
360 message, p->pid, p->comm, points); 360 message, task_pid_nr(p), p->comm, points);
361 361
362 /* Try to kill a child first */ 362 /* Try to kill a child first */
363 list_for_each(tsk, &p->children) { 363 list_for_each_entry(c, &p->children, sibling) {
364 c = list_entry(tsk, struct task_struct, sibling);
365 if (c->mm == p->mm) 364 if (c->mm == p->mm)
366 continue; 365 continue;
367 if (!oom_kill_task(c)) 366 if (!oom_kill_task(c))