mm/oom_kill: cleanup the "kill sharing same memory" loop
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hillf Danton
Acked-byQuoted 20 lines
Purely cosmetic, but the complex "if" condition looks annoying to me. Especially because it is not consistent with
OOM_SCORE_ADJ_MINcheck which adds another if/continue.Signed-off-by Oleg Nesterov <[email protected]>--- mm/oom_kill.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)mm/oom_kill.c +0
-2@@ -583,14 +583,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) &&
mm/oom_kill.c void oom_kill_process(struct oom_control *oc, struct task_struct *p, · line 592
Quoted 10 lines
mm/oom_kill.c +7
-3- !(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 ;
Given the result of "grep -nr PF_KTHREAD linux-next/mm", it looks a helper function, like current_is_kswapd(), is needed.
int task_is_kthread(struct task_struct *task)
Other than that,
Acked-by Hillf Danton <[email protected]>
Quoted 14 lines
mm/oom_kill.c +4
-3+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 ();mmput (mm); --2.4.3