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.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 3791edfffeeb..a7001410ab15 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -147,9 +147,11 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
147 * Adjust the score by oomkilladj. 147 * Adjust the score by oomkilladj.
148 */ 148 */
149 if (p->oomkilladj) { 149 if (p->oomkilladj) {
150 if (p->oomkilladj > 0) 150 if (p->oomkilladj > 0) {
151 if (!points)
152 points = 1;
151 points <<= p->oomkilladj; 153 points <<= p->oomkilladj;
152 else 154 } else
153 points >>= -(p->oomkilladj); 155 points >>= -(p->oomkilladj);
154 } 156 }
155 157
@@ -397,6 +399,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
397 struct task_struct *p; 399 struct task_struct *p;
398 unsigned long points = 0; 400 unsigned long points = 0;
399 unsigned long freed = 0; 401 unsigned long freed = 0;
402 int constraint;
400 403
401 blocking_notifier_call_chain(&oom_notify_list, 0, &freed); 404 blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
402 if (freed > 0) 405 if (freed > 0)
@@ -411,14 +414,18 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
411 show_mem(); 414 show_mem();
412 } 415 }
413 416
414 cpuset_lock(); 417 if (sysctl_panic_on_oom == 2)
415 read_lock(&tasklist_lock); 418 panic("out of memory. Compulsory panic_on_oom is selected.\n");
416 419
417 /* 420 /*
418 * Check if there were limitations on the allocation (only relevant for 421 * Check if there were limitations on the allocation (only relevant for
419 * NUMA) that may require different handling. 422 * NUMA) that may require different handling.
420 */ 423 */
421 switch (constrained_alloc(zonelist, gfp_mask)) { 424 constraint = constrained_alloc(zonelist, gfp_mask);
425 cpuset_lock();
426 read_lock(&tasklist_lock);
427
428 switch (constraint) {
422 case CONSTRAINT_MEMORY_POLICY: 429 case CONSTRAINT_MEMORY_POLICY:
423 oom_kill_process(current, points, 430 oom_kill_process(current, points,
424 "No available memory (MPOL_BIND)"); 431 "No available memory (MPOL_BIND)");