Message ID | 1528369223-7571-3-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu 07-06-18 20:00:22, Tetsuo Handa wrote: > To avoid oversights when adding the "mm, oom: cgroup-aware OOM killer" > patchset, simplify the exception case handling in out_of_memory(). > This patch makes no functional changes. > > Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> > Cc: Roman Gushchin <guro@fb.com> > Cc: Michal Hocko <mhocko@suse.com> > Cc: Johannes Weiner <hannes@cmpxchg.org> > Cc: Vladimir Davydov <vdavydov.dev@gmail.com> > Cc: David Rientjes <rientjes@google.com> > Cc: Tejun Heo <tj@kernel.org> Acked-by: Michal Hocko <mhocko@suse.com> with a minor nit > --- > mm/oom_kill.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index 23ce67f..5a6f1b1 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -1073,15 +1073,18 @@ bool out_of_memory(struct oom_control *oc) > } > > select_bad_process(oc); > + if (oc->chosen == (void *)-1UL) I think this one deserves a comment. /* There is an inflight oom victim *. > + return true; > /* Found nothing?!?! Either we hang forever, or we panic. */ > - if (!oc->chosen && !is_sysrq_oom(oc) && !is_memcg_oom(oc)) { > + if (!oc->chosen) { > + if (is_sysrq_oom(oc) || is_memcg_oom(oc)) > + return false; > dump_header(oc, NULL); > panic("Out of memory and no killable processes...\n"); > } > - if (oc->chosen && oc->chosen != (void *)-1UL) > - oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" : > - "Memory cgroup out of memory"); > - return !!oc->chosen; > + oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" : > + "Memory cgroup out of memory"); > + return true; > } > > /* > -- > 1.8.3.1 >
On Thu, 7 Jun 2018, Tetsuo Handa wrote: > To avoid oversights when adding the "mm, oom: cgroup-aware OOM killer" > patchset, simplify the exception case handling in out_of_memory(). > This patch makes no functional changes. > > Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> > Cc: Roman Gushchin <guro@fb.com> > Cc: Michal Hocko <mhocko@suse.com> > Cc: Johannes Weiner <hannes@cmpxchg.org> > Cc: Vladimir Davydov <vdavydov.dev@gmail.com> > Cc: David Rientjes <rientjes@google.com> > Cc: Tejun Heo <tj@kernel.org> Acked-by: David Rientjes <rientjes@google.com>
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 23ce67f..5a6f1b1 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -1073,15 +1073,18 @@ bool out_of_memory(struct oom_control *oc) } select_bad_process(oc); + if (oc->chosen == (void *)-1UL) + return true; /* Found nothing?!?! Either we hang forever, or we panic. */ - if (!oc->chosen && !is_sysrq_oom(oc) && !is_memcg_oom(oc)) { + if (!oc->chosen) { + if (is_sysrq_oom(oc) || is_memcg_oom(oc)) + return false; dump_header(oc, NULL); panic("Out of memory and no killable processes...\n"); } - if (oc->chosen && oc->chosen != (void *)-1UL) - oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" : - "Memory cgroup out of memory"); - return !!oc->chosen; + oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" : + "Memory cgroup out of memory"); + return true; } /*
To avoid oversights when adding the "mm, oom: cgroup-aware OOM killer" patchset, simplify the exception case handling in out_of_memory(). This patch makes no functional changes. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: Roman Gushchin <guro@fb.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Vladimir Davydov <vdavydov.dev@gmail.com> Cc: David Rientjes <rientjes@google.com> Cc: Tejun Heo <tj@kernel.org> --- mm/oom_kill.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)