From: Oleg Nesterov Date: Fri, 6 Nov 2015 02:48:23 +0000 (-0800) Subject: mm/oom_kill: cleanup the "kill sharing same memory" loop X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c319025a6c79e532d862e3a0b9506ba316a4d13a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: Oleg Nesterov Acked-by: David Rientjes Acked-by: Michal Hocko Acked-by: Hillf Danton Cc: Tetsuo Handa Cc: Kyle Walker Cc: Stanislav Kozina Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/oom_kill.c b/mm/oom_kill.c index c837d06dce5a..2b6e8809d7a8 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -574,14 +574,18 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p, * pending fatal signal. */ rcu_read_lock(); - for_each_process(p) - if (p->mm == mm && !same_thread_group(p, victim) && - !(p->flags & PF_KTHREAD)) { - if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) - continue; + for_each_process(p) { + if (p->mm != mm) + continue; + if (same_thread_group(p, victim)) + 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(); mmdrop(mm);