gpio: pca953x: add a comment explaining the need for a lockdep subclass
[cascardo/linux.git] / mm / oom_kill.c
index 5a3ba96..ec9f11d 100644 (file)
@@ -403,9 +403,14 @@ static void dump_tasks(struct mem_cgroup *memcg, const nodemask_t *nodemask)
 
 static void dump_header(struct oom_control *oc, struct task_struct *p)
 {
-       pr_warn("%s invoked oom-killer: gfp_mask=%#x(%pGg), order=%d, oom_score_adj=%hd\n",
-               current->comm, oc->gfp_mask, &oc->gfp_mask, oc->order,
+       nodemask_t *nm = (oc->nodemask) ? oc->nodemask : &cpuset_current_mems_allowed;
+
+       pr_warn("%s invoked oom-killer: gfp_mask=%#x(%pGg), nodemask=%*pbl, order=%d, oom_score_adj=%hd\n",
+               current->comm, oc->gfp_mask, &oc->gfp_mask,
+               nodemask_pr_args(nm), oc->order,
                current->signal->oom_score_adj);
+       if (!IS_ENABLED(CONFIG_COMPACTION) && oc->order)
+               pr_warn("COMPACTION is disabled!!!\n");
 
        cpuset_print_current_mems_allowed();
        dump_stack();
@@ -902,13 +907,7 @@ static void oom_kill_process(struct oom_control *oc, const char *message)
                        continue;
                if (same_thread_group(p, victim))
                        continue;
-               if (unlikely(p->flags & PF_KTHREAD) || is_global_init(p)) {
-                       /*
-                        * We cannot use oom_reaper for the mm shared by this
-                        * process because it wouldn't get killed and so the
-                        * memory might be still used. Hide the mm from the oom
-                        * killer to guarantee OOM forward progress.
-                        */
+               if (is_global_init(p)) {
                        can_oom_reap = false;
                        set_bit(MMF_OOM_SKIP, &mm->flags);
                        pr_info("oom killer %d (%s) has mm pinned by %d (%s)\n",
@@ -916,6 +915,12 @@ static void oom_kill_process(struct oom_control *oc, const char *message)
                                        task_pid_nr(p), p->comm);
                        continue;
                }
+               /*
+                * No use_mm() user needs to read from the userspace so we are
+                * ok to reap it.
+                */
+               if (unlikely(p->flags & PF_KTHREAD))
+                       continue;
                do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, true);
        }
        rcu_read_unlock();
@@ -1067,16 +1072,6 @@ void pagefault_out_of_memory(void)
 
        if (!mutex_trylock(&oom_lock))
                return;
-
-       if (!out_of_memory(&oc)) {
-               /*
-                * There shouldn't be any user tasks runnable while the
-                * OOM killer is disabled, so the current task has to
-                * be a racing OOM victim for which oom_killer_disable()
-                * is waiting for.
-                */
-               WARN_ON(test_thread_flag(TIF_MEMDIE));
-       }
-
+       out_of_memory(&oc);
        mutex_unlock(&oom_lock);
 }