Commit c319025a authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

mm/oom_kill: cleanup the "kill sharing same memory" loop

Purely cosmetic, but the complex "if" condition looks annoying to me.
Especially because it is not consistent with OOM_SCORE_ADJ_MIN check
which adds another if/continue.
Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Acked-by: default avatarHillf Danton <hillf.zj@alibaba-inc.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Kyle Walker <kwalker@redhat.com>
Cc: Stanislav Kozina <skozina@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0c1b2d78
...@@ -574,14 +574,18 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p, ...@@ -574,14 +574,18 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
* pending fatal signal. * pending fatal signal.
*/ */
rcu_read_lock(); rcu_read_lock();
for_each_process(p) for_each_process(p) {
if (p->mm == mm && !same_thread_group(p, victim) && if (p->mm != mm)
!(p->flags & PF_KTHREAD)) { continue;
if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) if (same_thread_group(p, victim))
continue; continue;
if (unlikely(p->flags & PF_KTHREAD))
continue;
if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN)
continue;
do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, true); do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, true);
} }
rcu_read_unlock(); rcu_read_unlock();
mmdrop(mm); mmdrop(mm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment