From: Martin KaFai Lau <martin.lau@linux.dev>
To: Michal Hocko <mhocko@suse.com>,
Roman Gushchin <roman.gushchin@linux.dev>
Cc: Chuyi Zhou <zhouchuyi@bytedance.com>,
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: Thu, 10 Aug 2023 12:41:01 -0700 [thread overview]
Message-ID: <c390dc64-280e-6d9f-661a-9a5d77f16cf8@linux.dev> (raw)
In-Reply-To: <ZNNGFzwlv1dC866j@dhcp22.suse.cz>
>>>> First, I'm a bit concerned about implicit restrictions we apply to bpf programs
>>>> which will be executed potentially thousands times under a very heavy memory
>>>> pressure. We will need to make sure that they don't allocate (much) memory, don't
>>>> take any locks which might deadlock with other memory allocations etc.
>>>> It will potentially require hard restrictions on what these programs can and can't
>>>> do and this is something that the bpf community will have to maintain long-term.
>>>
>>> Right, BPF callbacks operating under OOM situations will be really
>>> constrained but this is more or less by definition. Isn't it?
>>
>> What do you mean?
>
> Callbacks cannot depend on any direct or indirect memory allocations.
> Dependencies on any sleeping locks (again directly or indirectly) is not
> allowed just to name the most important ones.
>
>> In general, the bpf community is trying to make it as generic as possible and
>> adding new and new features. Bpf programs are not as constrained as they were
>> when it's all started.
bpf supports different running context. For example, only non-sleepable bpf prog
is allowed to run at the NIC driver. A sleepable bpf prog is only allowed to run
at some bpf_lsm hooks that is known to be safe to call blocking
bpf-helper/kfunc. From the bpf side, it ensures a non-sleepable bpf prog cannot
do things that may block.
fwiw, Dave has recently proposed something for iterating the task vma
(https://lore.kernel.org/bpf/20230810183513.684836-4-davemarchevsky@fb.com/).
Potentially, a similar iterator can be created for a bpf program to iterate
cgroups and tasks.
next prev parent reply other threads:[~2023-08-10 19:41 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 [this message]
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
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=c390dc64-280e-6d9f-661a-9a5d77f16cf8@linux.dev \
--to=martin.lau@linux.dev \
--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=mhocko@suse.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox