All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Chuyi Zhou <zhouchuyi@bytedance.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>,
	hannes@cmpxchg.org, 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: Tue, 22 Aug 2023 14:42:09 +0200	[thread overview]
Message-ID: <ZOStIZsF5rfGkvbJ@dhcp22.suse.cz> (raw)
In-Reply-To: <78648d96-8899-6ac6-62d4-9e5b34ac004e@bytedance.com>

[Still catching up with older threads. Sorry for the late reply]
On Mon 14-08-23 19:25:08, Chuyi Zhou wrote:
> Hello,
> 
> 在 2023/8/9 15:53, Michal Hocko 写道:
> > On Tue 08-08-23 14:41:17, Roman Gushchin wrote:
[...]
> > > It would be also nice to come up with some practical examples of bpf programs.
> > > What are meaningful scenarios which can be covered with the proposed approach
> > > and are not covered now with oom_score_adj.
> > 
> Just like Abel said, the oom_score_adj only adjusts the memory usage-based
> decisions, and it's hard to be translated into other semantics. We see that
> some userspace oom-killer like oomd has implemented policies based on other
> semantics(e.g., memory growth, priority, psi pressure, ect.) which can be
> useful in some specific scenario.

Sure, I guess we do not really need to discuss that oom_score_adj is not
a great fit ;) We want to have practical (read no-toy) oom policies that
are useful as a PoC though.

> > Agreed here as well. This RFC serves purpose of brainstorming on all of
> > this.
> > 
> > There is a fundamental question whether we need BPF for this task in the
> > first place. Are there any huge advantages to export the callback and
> > allow a kernel module to hook into it?
> 
> If we export the callback to a kernel module and hook into it,
> We still have the same problems (e.g., allocating much memory). Just like
> Martin saied, at least BPF supports some basic running context and some
> unsafe behavior is restricted.

I do not follow. Kernel module has access to any existing kernel
interfaces without any need to BPF them. So what exactly is the strength
of the BPF over kernel module hook? I am pretty sure there are some
(many?) but it is really important to be explicit about those before we
make any decision.

-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2023-08-22 12:42 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 [this message]
2023-08-04 11:34   ` Alan Maguire
2023-08-04 23:55     ` Chuyi Zhou
2023-08-07  8:32       ` Michal Hocko
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=ZOStIZsF5rfGkvbJ@dhcp22.suse.cz \
    --to=mhocko@suse.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.