mm, oom: remove unnecessary variable
The "killed" variable in out_of_memory() can be removed since the call to oom_kill_process() where we should block to allow the process time to exit is obvious. Signed-off-by: David Rientjes <rientjes@google.com> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
8989e4c7d4
commit
75e8f8b24c
|
@ -645,7 +645,6 @@ bool out_of_memory(struct oom_control *oc)
|
||||||
unsigned long freed = 0;
|
unsigned long freed = 0;
|
||||||
unsigned int uninitialized_var(points);
|
unsigned int uninitialized_var(points);
|
||||||
enum oom_constraint constraint = CONSTRAINT_NONE;
|
enum oom_constraint constraint = CONSTRAINT_NONE;
|
||||||
int killed = 0;
|
|
||||||
|
|
||||||
if (oom_killer_disabled)
|
if (oom_killer_disabled)
|
||||||
return false;
|
return false;
|
||||||
|
@ -653,7 +652,7 @@ bool out_of_memory(struct oom_control *oc)
|
||||||
blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
|
blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
|
||||||
if (freed > 0)
|
if (freed > 0)
|
||||||
/* Got some memory back in the last second. */
|
/* Got some memory back in the last second. */
|
||||||
goto out;
|
return true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If current has a pending SIGKILL or is exiting, then automatically
|
* If current has a pending SIGKILL or is exiting, then automatically
|
||||||
|
@ -666,7 +665,7 @@ bool out_of_memory(struct oom_control *oc)
|
||||||
if (current->mm &&
|
if (current->mm &&
|
||||||
(fatal_signal_pending(current) || task_will_free_mem(current))) {
|
(fatal_signal_pending(current) || task_will_free_mem(current))) {
|
||||||
mark_oom_victim(current);
|
mark_oom_victim(current);
|
||||||
goto out;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -684,7 +683,7 @@ bool out_of_memory(struct oom_control *oc)
|
||||||
get_task_struct(current);
|
get_task_struct(current);
|
||||||
oom_kill_process(oc, current, 0, totalpages, NULL,
|
oom_kill_process(oc, current, 0, totalpages, NULL,
|
||||||
"Out of memory (oom_kill_allocating_task)");
|
"Out of memory (oom_kill_allocating_task)");
|
||||||
goto out;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = select_bad_process(oc, &points, totalpages);
|
p = select_bad_process(oc, &points, totalpages);
|
||||||
|
@ -696,16 +695,12 @@ bool out_of_memory(struct oom_control *oc)
|
||||||
if (p && p != (void *)-1UL) {
|
if (p && p != (void *)-1UL) {
|
||||||
oom_kill_process(oc, p, points, totalpages, NULL,
|
oom_kill_process(oc, p, points, totalpages, NULL,
|
||||||
"Out of memory");
|
"Out of memory");
|
||||||
killed = 1;
|
/*
|
||||||
}
|
* Give the killed process a good chance to exit before trying
|
||||||
out:
|
* to allocate memory again.
|
||||||
/*
|
*/
|
||||||
* Give the killed threads a good chance of exiting before trying to
|
|
||||||
* allocate memory again.
|
|
||||||
*/
|
|
||||||
if (killed)
|
|
||||||
schedule_timeout_killable(1);
|
schedule_timeout_killable(1);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue