From: "Hillf Danton" <hillf.zj@alibaba-inc.com>
To: "'Oleg Nesterov'" <oleg@redhat.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"David Rientjes" <rientjes@google.com>,
"'Kyle Walker'" <kwalker@redhat.com>,
"'Michal Hocko'" <mhocko@kernel.org>,
"linux-kernel" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -mm v2 2/3] mm/oom_kill: cleanup the "kill sharing same memory" loop
Date: Thu, 08 Oct 2015 14:43:49 +0800 [thread overview]
Message-ID: <04df01d10194$b1035bf0$130a13d0$@alibaba-inc.com> (raw)
In-Reply-To: <04db01d10192$615ef0c0$241cd240$@alibaba-inc.com>
>
> 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 <oleg@...hat.com>
> ---
> mm/oom_kill.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index b6b8c78..c189ee5 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -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) &&
> - !(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 <hillf.zj@alibaba-inc.com>
> + 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
>
>
next parent reply other threads:[~2015-10-08 6:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <04db01d10192$615ef0c0$241cd240$@alibaba-inc.com>
2015-10-08 6:43 ` Hillf Danton [this message]
2015-09-30 18:23 [PATCH -mm v2 0/3] mm/oom_kill: ensure we actually kill all tasks sharing the same mm Oleg Nesterov
2015-09-30 18:24 ` [PATCH -mm v2 2/3] mm/oom_kill: cleanup the "kill sharing same memory" loop Oleg Nesterov
2015-09-30 21:15 ` David Rientjes
2015-10-01 12:50 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='04df01d10194$b1035bf0$130a13d0$@alibaba-inc.com' \
--to=hillf.zj@alibaba-inc.com \
--cc=akpm@linux-foundation.org \
--cc=kwalker@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@kernel.org \
--cc=oleg@redhat.com \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome