|
@@ -962,6 +962,13 @@ static void oom_kill_process(struct oom_control *oc, const char *message)
|
|
|
* still freeing memory.
|
|
* still freeing memory.
|
|
|
*/
|
|
*/
|
|
|
read_lock(&tasklist_lock);
|
|
read_lock(&tasklist_lock);
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * The task 'p' might have already exited before reaching here. The
|
|
|
|
|
+ * put_task_struct() will free task_struct 'p' while the loop still try
|
|
|
|
|
+ * to access the field of 'p', so, get an extra reference.
|
|
|
|
|
+ */
|
|
|
|
|
+ get_task_struct(p);
|
|
|
for_each_thread(p, t) {
|
|
for_each_thread(p, t) {
|
|
|
list_for_each_entry(child, &t->children, sibling) {
|
|
list_for_each_entry(child, &t->children, sibling) {
|
|
|
unsigned int child_points;
|
|
unsigned int child_points;
|
|
@@ -981,6 +988,7 @@ static void oom_kill_process(struct oom_control *oc, const char *message)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ put_task_struct(p);
|
|
|
read_unlock(&tasklist_lock);
|
|
read_unlock(&tasklist_lock);
|
|
|
|
|
|
|
|
/*
|
|
/*
|