From: Michal Hocko <mhocko@suse.com>
To: Chuyi Zhou <zhouchuyi@bytedance.com>
Cc: Alan Maguire <alan.maguire@oracle.com>,
hannes@cmpxchg.org, roman.gushchin@linux.dev, ast@kernel.org,
daniel@iogearbox.net, andrii@kernel.org, muchun.song@linux.dev,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
wuyun.abel@bytedance.com, robin.lu@bytedance.com
Subject: Re: [RFC PATCH 1/2] mm, oom: Introduce bpf_select_task
Date: Mon, 7 Aug 2023 10:32:34 +0200 [thread overview]
Message-ID: <ZNCsIm+RK0LStUA6@dhcp22.suse.cz> (raw)
In-Reply-To: <fa736940-2840-efa7-11e5-493465788545@bytedance.com>
On Sat 05-08-23 07:55:56, Chuyi Zhou wrote:
> Hello,
>
> 在 2023/8/4 19:34, Alan Maguire 写道:
[...]
> > I don't know anything about OOM mechanisms, so maybe it's just me, but I
> > found this confusing. Relying on the previous iteration to control
> > current iteration behaviour seems risky - even if BPF found a victim in
> > iteration N, it's no guarantee it will in iteration N+1.
> >
> The current kernel's OOM actually works like this:
>
> 1. if we first find a valid candidate victim A in iteration N, we would
> record it in oc->chosen.
>
> 2. In iteration N + 1, N+2..., we just compare oc->chosen with the current
> iterating task. Suppose we think current task B is better than
> oc->chosen(A), we would set oc->chosen = B and we would not consider A
> anymore.
>
> IIUC, most policy works like this. We just need to find the *most* suitable
> victim. Normally, if in current iteration we drop A and select B, we would
> not consider A anymore.
Yes, we iterate over all tasks in the specific oom domain (all tasks for
global and all members of memcg tree for hard limit oom). The in-tree
oom policy has to iterate all tasks to achieve some of its goals (like
preventing overkilling while the previously selected victim is still on
the way out). Also oom_score_adj might change the final decision so you
have to really check all eligible tasks.
I can imagine a BPF based policy could be less constrained and as Roman
suggested have a pre-selected victims on stand by. I do not see problem
to have break like mode. Similar to current abort without a canceling an
already noted victim.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2023-08-07 8:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 9:38 [RFC PATCH 0/2] mm: Select victim using bpf_select_task Chuyi Zhou
2023-08-04 9:38 ` [RFC PATCH 1/2] mm, oom: Introduce bpf_select_task Chuyi Zhou
2023-08-04 11:29 ` Michal Hocko
2023-08-04 13:15 ` Chuyi Zhou
2023-08-04 13:34 ` Michal Hocko
2023-08-07 2:21 ` Chuyi Zhou
2023-08-07 7:04 ` Michal Hocko
2023-08-07 17:28 ` Roman Gushchin
2023-08-08 8:18 ` Michal Hocko
2023-08-08 21:41 ` Roman Gushchin
2023-08-09 7:53 ` Michal Hocko
2023-08-10 4:00 ` Abel Wu
2023-08-15 19:52 ` Roman Gushchin
2023-08-10 19:41 ` Martin KaFai Lau
2023-08-15 19:03 ` Roman Gushchin
2023-08-14 11:25 ` Chuyi Zhou
2023-08-22 12:42 ` Michal Hocko
2023-08-04 11:34 ` Alan Maguire
2023-08-04 23:55 ` Chuyi Zhou
2023-08-07 8:32 ` Michal Hocko [this message]
2023-08-04 9:38 ` [RFC PATCH 2/2] bpf: Add OOM policy test Chuyi Zhou
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=ZNCsIm+RK0LStUA6@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=muchun.song@linux.dev \
--cc=robin.lu@bytedance.com \
--cc=roman.gushchin@linux.dev \
--cc=wuyun.abel@bytedance.com \
--cc=zhouchuyi@bytedance.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.