diff options
| author | David Rientjes <rientjes@google.com> | 2015-09-08 15:00:47 -0700 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2019-07-08 13:36:44 +0200 |
| commit | 54b0b58224146d68a11bccb5e64683ab3029373a (patch) | |
| tree | e807e460ae72c345657b72dbaa7ee23847d34b03 | |
| parent | 50b9b5a38a78f88cf86f066fbe0bacbcb1d4682a (diff) | |
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.
Change-Id: Ic00ea1247542ce9c93a5ab18affd6f5b0c305aa9
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>
| -rw-r--r-- | mm/oom_kill.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 4f0698b23..ed09e25f2 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -693,7 +693,6 @@ bool out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, unsigned long freed = 0; unsigned int uninitialized_var(points); enum oom_constraint constraint = CONSTRAINT_NONE; - int killed = 0; if (oom_killer_disabled) return false; @@ -706,7 +705,7 @@ bool out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, blocking_notifier_call_chain(&oom_notify_list, 0, &freed); if (freed > 0) /* Got some memory back in the last second. */ - goto out; + return true; /* * If current has a pending SIGKILL or is exiting, then automatically @@ -720,7 +719,7 @@ bool out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, (fatal_signal_pending(current) || task_will_free_mem(current))) { mark_oom_victim(current); last_victim = jiffies; - goto out; + return true; } /* @@ -739,7 +738,7 @@ bool out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, oom_kill_process(current, gfp_mask, order, 0, totalpages, NULL, nodemask, "Out of memory (oom_kill_allocating_task)"); - goto out; + return true; } p = select_bad_process(&points, totalpages, mpol_mask, force_kill); @@ -751,16 +750,12 @@ bool out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, if (PTR_ERR(p) != -1UL) { oom_kill_process(p, gfp_mask, order, points, totalpages, NULL, nodemask, "Out of memory"); - killed = 1; - } -out: - /* - * Give the killed threads a good chance of exiting before trying to - * allocate memory again. - */ - if (killed) + /* + * Give the killed process a good chance to exit before trying + * to allocate memory again. + */ schedule_timeout_killable(1); - + } return true; } |
