From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: mhocko@kernel.org, aarcange@redhat.com
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm,oom: Move last second allocation to inside the OOM killer.
Date: Thu, 2 Nov 2017 20:15:55 +0900 [thread overview]
Message-ID: <201711022015.BBE95844.QOHtJFMLFOOSVF@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <20171101132700.qf4exnqezaepjgat@dhcp22.suse.cz>
Michal Hocko wrote:
> I would really suggest you to stick with the changelog I have suggested.
>
Well, I think that this patch needs to clarify why using ALLOC_WMARK_HIGH.
> On Wed 01-11-17 20:54:27, Tetsuo Handa wrote:
> [...]
> > diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> > index 26add8a..118ecdb 100644
> > --- a/mm/oom_kill.c
> > +++ b/mm/oom_kill.c
> > @@ -870,6 +870,19 @@ static void oom_kill_process(struct oom_control *oc, const char *message)
> > }
> > task_unlock(p);
> >
> > + /*
> > + * Try really last second allocation attempt after we selected an OOM
> > + * victim, for somebody might have managed to free memory while we were
> > + * selecting an OOM victim which can take quite some time.
> > + */
> > + if (oc->ac) {
> > + oc->page = alloc_pages_before_oomkill(oc);
>
> I would stick the oc->ac check inside alloc_pages_before_oomkill.
OK.
>
> > + if (oc->page) {
> > + put_task_struct(p);
> > + return;
> > + }
> > + }
> > +
> > if (__ratelimit(&oom_rs))
> > dump_header(oc, p);
> >
> > @@ -1081,6 +1094,16 @@ bool out_of_memory(struct oom_control *oc)
> > select_bad_process(oc);
> > /* Found nothing?!?! Either we hang forever, or we panic. */
> > if (!oc->chosen && !is_sysrq_oom(oc) && !is_memcg_oom(oc)) {
> > + /*
> > + * Try really last second allocation attempt, for somebody
> > + * might have managed to free memory while we were trying to
> > + * find an OOM victim.
> > + */
> > + if (oc->ac) {
> > + oc->page = alloc_pages_before_oomkill(oc);
> > + if (oc->page)
> > + return true;
> > + }
> > dump_header(oc, NULL);
> > panic("Out of memory and no killable processes...\n");
> > }
>
> Also, is there any strong reason to not do the last allocation after
> select_bad_process rather than having two call sites? I would understand
> that if you wanted to catch for_each_thread inside oom_kill_process but
> you are not doing that.
Unfortunately, we will after all have two call sites because we have
sysctl_oom_kill_allocating_task path.
V2 patch follows. Andrea, will you check that your intent of using high
watermark for last second allocation attempt in the change log is correct?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-11-02 11:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-01 11:54 Tetsuo Handa
2017-11-01 11:54 ` [PATCH 2/2] mm,oom: Use ALLOC_OOM for OOM victim's last second allocation Tetsuo Handa
2017-11-01 13:58 ` Michal Hocko
2017-11-01 15:08 ` Tetsuo Handa
2017-11-01 15:16 ` Michal Hocko
2017-11-01 13:27 ` [PATCH 1/2] mm,oom: Move last second allocation to inside the OOM killer Michal Hocko
2017-11-02 11:15 ` Tetsuo Handa [this message]
2017-11-02 11:16 ` [PATCH v2 " Tetsuo Handa
2017-11-02 11:16 ` [PATCH v2 2/2] mm,oom: Use ALLOC_OOM for OOM victim's last second allocation Tetsuo Handa
2017-11-02 13:14 ` Michal Hocko
2017-11-02 13:21 ` [PATCH v2 1/2] mm,oom: Move last second allocation to inside the OOM killer Michal Hocko
2017-11-03 13:46 ` [PATCH] mm,page_alloc: Update comment for last second allocation attempt Tetsuo Handa
2017-11-03 13:57 ` Michal Hocko
2017-11-03 14:08 ` Tetsuo Handa
2017-11-03 14:17 ` Michal Hocko
2017-11-03 14:27 ` Tetsuo Handa
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=201711022015.BBE95844.QOHtJFMLFOOSVF@I-love.SAKURA.ne.jp \
--to=penguin-kernel@i-love.sakura.ne.jp \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
/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