From: Michal Hocko <mhocko@suse.com>
To: Zackary Liu <zackary.liu.pro@gmail.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/oom_kill: break evaluation when a task has been selected
Date: Mon, 6 Jun 2022 10:33:29 +0200 [thread overview]
Message-ID: <Yp272UqXecNsmC1z@dhcp22.suse.cz> (raw)
In-Reply-To: <6BC32F66-2AC4-450D-90D5-B7A09455B617@getmailspring.com>
On Sat 04-06-22 18:35:19, Zackary Liu wrote:
>
> On Jun 1 2022, at 3:45 pm, Michal Hocko <mhocko@suse.com> wrote:
>
> > On Sat 14-05-22 15:52:28, Zhaoyu Liu wrote:
> >> oom points no longer need to be calculated if a task is oom_task_origin(),
> >> so return 1 to stop the oom_evaluate_task().
> >
> > This doesn't really explain why this is really desired. Is this a fix,
> > optimization?
> >
> > Please also note that this change has some side effects. For one, the
> > task marked as oom origin will get killed even if there is still a
> > pending oom victim which hasn't been fully dismantled. Is this
> > intentional?
>
> Thank you very much for reminding.
>
> From my point of view, the victim was marked in the last oom, and now it
> has entered the oom again, which means that the system still has no
> deprecated memory available.
This is not an unusual situation. OOM victims can take some time to die
and release their memory. The oom_reaper is there to fast forward that
process and guarantee a forward progress. But this can still take some
time. Our general policy is to back off when there is an alive oom
victim encountered. Have a look at the tsk_is_oom_victim test in
oom_evaluate_task. For that heuristic to be effective the whole task
list (wether the global one or memcg) has to be evaluated.
> In order to ensure that the system can
> return to normal as soon as possible, killing the origin task
> immediately should be A good choice, and the role of this patch is to
> end oom_evaluate_task and return true as soon as the origin task is found.
Could you be more specific how does this patch guarantees a forward
progress? What is the actual usecase that benefits from this change?
These are all important information for future reference. Please note I
am not saying the patch is wrong. I just still do not see why it is
useful.
> Maybe this patch is not the optimal solution, it has a trade-off.
If there are trade-offs, please document them in the changelog.
The way I see it is that oom_task_origin heuristic has been introduced
to help killing swapoff operation because the swapped out memory doesn't
fit into memory. This is a very reasonable thing to do in general but it
also represents an early failure visible to the userspace. If there is a
pre-existing oom victim then I would argue that we should try to avoid
the failure.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2022-06-06 8:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-14 7:52 Zhaoyu Liu
2022-06-01 7:45 ` Michal Hocko
2022-06-04 10:35 ` Zackary Liu
2022-06-06 8:33 ` Michal Hocko [this message]
2022-06-14 7:48 ` 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=Yp272UqXecNsmC1z@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=zackary.liu.pro@gmail.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