Merge tag 'v3.10.68' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / mm / oom_kill.c
index 1a582e3aee3eb700004dd93b95cd66dee8928d0e..219cc120f6fcc4f39cf443b9d5888ed41b06909f 100644 (file)
@@ -466,6 +466,17 @@ void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
                list_for_each_entry(child, &t->children, sibling) {
                        unsigned int child_points;
 
+            /*LCH add for race condition*/
+            if (p->flags & PF_EXITING) {
+                read_unlock(&tasklist_lock);
+                task_lock(p);
+                pr_err("%s: process %d (%s) is exiting\n", message, task_pid_nr(p), p->comm);
+                task_unlock(p);
+                set_tsk_thread_flag(p, TIF_MEMDIE);
+                put_task_struct(p);
+                       return;
+            }
+
                        if (child->mm == p->mm)
                                continue;
                        /*
@@ -641,6 +652,11 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
        enum oom_constraint constraint = CONSTRAINT_NONE;
        int killed = 0;
 
+#ifdef CONFIG_MT_ENG_BUILD
+       //void add_kmem_status_oom_counter(void);
+       //add_kmem_status_oom_counter();
+#endif
+
        blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
        if (freed > 0)
                /* Got some memory back in the last second. */
@@ -704,7 +720,7 @@ void pagefault_out_of_memory(void)
 {
        struct zonelist *zonelist;
 
-       if (mem_cgroup_oom_synchronize())
+       if (mem_cgroup_oom_synchronize(true))
                return;
 
        zonelist = node_zonelist(first_online_node, GFP_KERNEL);