]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - mm/oom_kill.c
blkcg: revert blkcg cleanups series
[linux.git] / mm / oom_kill.c
index b5b25e4dcbbb707e5d7ad0ae588a88ca2dc49e88..6589f60d50186aca3812be1a9ae3d8ba7369b87b 100644 (file)
@@ -522,6 +522,7 @@ bool __oom_reap_task_mm(struct mm_struct *mm)
 
                        tlb_gather_mmu(&tlb, mm, start, end);
                        if (mmu_notifier_invalidate_range_start_nonblock(mm, start, end)) {
+                               tlb_finish_mmu(&tlb, start, end);
                                ret = false;
                                continue;
                        }
@@ -858,7 +859,7 @@ static void __oom_kill_process(struct task_struct *victim)
         * in order to prevent the OOM victim from depleting the memory
         * reserves from the user space under its control.
         */
-       do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, PIDTYPE_TGID);
+       do_send_sig_info(SIGKILL, SEND_SIG_PRIV, victim, PIDTYPE_TGID);
        mark_oom_victim(victim);
        pr_err("Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\n",
                task_pid_nr(victim), victim->comm, K(victim->mm->total_vm),
@@ -896,7 +897,7 @@ static void __oom_kill_process(struct task_struct *victim)
                 */
                if (unlikely(p->flags & PF_KTHREAD))
                        continue;
-               do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, PIDTYPE_TGID);
+               do_send_sig_info(SIGKILL, SEND_SIG_PRIV, p, PIDTYPE_TGID);
        }
        rcu_read_unlock();
 
@@ -1103,10 +1104,17 @@ bool out_of_memory(struct oom_control *oc)
        }
 
        select_bad_process(oc);
-       /* Found nothing?!?! Either we hang forever, or we panic. */
-       if (!oc->chosen && !is_sysrq_oom(oc) && !is_memcg_oom(oc)) {
+       /* Found nothing?!?! */
+       if (!oc->chosen) {
                dump_header(oc, NULL);
-               panic("Out of memory and no killable processes...\n");
+               pr_warn("Out of memory and no killable processes...\n");
+               /*
+                * If we got here due to an actual allocation at the
+                * system level, we cannot survive this and will enter
+                * an endless loop in the allocator. Bail out now.
+                */
+               if (!is_sysrq_oom(oc) && !is_memcg_oom(oc))
+                       panic("System is deadlocked on memory\n");
        }
        if (oc->chosen && oc->chosen != (void *)-1UL)
                oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" :