提交 c319025a 编写于 作者: O Oleg Nesterov 提交者: 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: NOleg Nesterov <oleg@redhat.com>
Acked-by: NDavid Rientjes <rientjes@google.com>
Acked-by: NMichal Hocko <mhocko@suse.com>
Acked-by: NHillf 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: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册