mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Alan Maguire <alan.maguire@oracle.com>,
	Chuyi Zhou <zhouchuyi@bytedance.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>, bpf <bpf@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	wuyun.abel@bytedance.com, robin.lu@bytedance.com
Subject: Re: [RFC PATCH 0/5] mm: Select victim memcg using BPF_OOM_POLICY
Date: Thu, 27 Jul 2023 19:17:44 +0200	[thread overview]
Message-ID: <ZMKmuLqyjePWESux@dhcp22.suse.cz> (raw)
In-Reply-To: <CAADnVQLdu_6aJH+0wwpKB146HvxkhvL-uRGAqSPZ8jDMAMqX=A@mail.gmail.com>

On Thu 27-07-23 08:57:03, Alexei Starovoitov wrote:
> On Thu, Jul 27, 2023 at 4:45 AM Alan Maguire <alan.maguire@oracle.com> wrote:
> >
> > On 27/07/2023 08:36, Chuyi Zhou wrote:
> > > This patchset tries to add a new bpf prog type and use it to select
> > > a victim memcg when global OOM is invoked. The mainly motivation is
> > > the need to customizable OOM victim selection functionality so that
> > > we can protect more important app from OOM killer.
> > >
> >
> > It's a nice use case, but at a high level, the approach pursued here
> > is, as I understand it, discouraged for new BPF program development.
> > Specifically, adding a new BPF program type with semantics like this
> > is not preferred. Instead, can you look at using something like
> >
> > - using "fmod_ret" instead of a new program type
> > - use BPF kfuncs instead of helpers.
> > - add selftests in tools/testing/selftests/bpf not samples.
> 
> +1 to what Alan said above and below.
> 
> Also as Michal said there needs to be a design doc with pros and cons.
> We see far too often that people attempt to use BPF in places where it
> shouldn't be.
> If programmability is not strictly necessary then BPF is not a good fit.

To be completely honest I am not sure whether BPF is the right fit
myself. It is definitely a path to be explored but maybe we will learn
not the proper one in the end. The primary reason for considering it
though is that there is endless (+1) different policies how to select a
victim to kill on OOM. So having an interface to hook into and make that
decision sounds very promissing. This might be something very static
like EXPORT_SYMBOL that a kernel module can hook into or a more broader
BPF callback that could be more generic and therefore allow for easier
to define policy AFAIU.
-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2023-07-27 17:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27  7:36 Chuyi Zhou
2023-07-27  7:36 ` [RFC PATCH 1/5] bpf: Introduce BPF_PROG_TYPE_OOM_POLICY Chuyi Zhou
2023-07-27  7:36 ` [RFC PATCH 2/5] mm: Select victim memcg using bpf prog Chuyi Zhou
2023-07-27  7:36 ` [RFC PATCH 3/5] libbpf, bpftool: Support BPF_PROG_TYPE_OOM_POLICY Chuyi Zhou
2023-07-27 12:26   ` Quentin Monnet
2023-07-28  3:01     ` Chuyi Zhou
2023-07-27  7:36 ` [RFC PATCH 4/5] bpf: Add a new bpf helper to get cgroup ino Chuyi Zhou
2023-07-27  7:36 ` [RFC PATCH 5/5] bpf: Sample BPF program to set oom policy Chuyi Zhou
2023-07-27  8:15 ` [RFC PATCH 0/5] mm: Select victim memcg using BPF_OOM_POLICY Michal Hocko
2023-07-27 12:12   ` Chuyi Zhou
2023-07-27 17:23     ` Michal Hocko
2023-07-31  6:00       ` Chuyi Zhou
2023-07-31 13:23         ` Michal Hocko
2023-07-31 16:26           ` Chuyi Zhou
2023-08-01  8:18             ` Michal Hocko
2023-08-02  3:04               ` Chuyi Zhou
2023-07-28  4:30   ` Roman Gushchin
2023-07-28  8:06     ` Michal Hocko
2023-07-28 18:42       ` Roman Gushchin
2023-07-31 13:12         ` Michal Hocko
2023-08-01  6:53     ` Abel Wu
2023-07-27 11:43 ` Alan Maguire
2023-07-27 15:57   ` Alexei Starovoitov
2023-07-27 17:17     ` Michal Hocko [this message]
2023-07-28  2:34   ` [External] " 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=ZMKmuLqyjePWESux@dhcp22.suse.cz \
    --to=mhocko@suse.com \
    --cc=alan.maguire@oracle.com \
    --cc=alexei.starovoitov@gmail.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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®