Re: [PATCH bpf-next 0/5] bpf: BPF specific memory allocator.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 06, 2022 at 11:51:03AM -0700, Alexei Starovoitov wrote:
> On Wed, Jul 06, 2022 at 07:40:44PM +0100, Matthew Wilcox wrote:
> > On Wed, Jul 06, 2022 at 11:36:19AM -0700, Alexei Starovoitov wrote:
> > > On Wed, Jul 06, 2022 at 07:31:34PM +0100, Matthew Wilcox wrote:
> > > > On Wed, Jul 06, 2022 at 11:26:35AM -0700, Alexei Starovoitov wrote:
> > > > > On Wed, Jul 06, 2022 at 07:21:29PM +0100, Matthew Wilcox wrote:
> > > > > > On Wed, Jul 06, 2022 at 11:05:25AM -0700, Alexei Starovoitov wrote:
> > > > > > > On Wed, Jul 06, 2022 at 06:55:36PM +0100, Matthew Wilcox wrote:
> > > > > > > > For example, I assume that a BPF program
> > > > > > > > has a fairly tight limit on how much memory it can cause to be allocated.
> > > > > > > > Right?
> > > > > > > 
> > > > > > > No. It's constrained by memcg limits only. It can allocate gigabytes.
> > > > > > 
> > > > > > I'm confused.  A BPF program is limited to executing 4096 insns and
> > > > > > using a maximum of 512 bytes of stack space, but it can allocate an
> > > > > > unlimited amount of heap?  That seems wrong.
> > > > > 
> > > > > 4k insn limit was lifted years ago.
> > > > 
> > > > You might want to update the documentation.
> > > > https://www.kernel.org/doc/html/latest/bpf/bpf_design_QA.html
> > > > still says 4096.
> > > 
> > > No. Please read what you're quoting first.
> > 
> > I did read it.  It says
> > 
> > : The only limit known to the user space is BPF_MAXINSNS (4096). It’s the
> > : maximum number of instructions that the unprivileged bpf program can have.
> > 
> > It really seems pretty clear to me.  You're saying my understanding
> > is wrong.  So it must be badly written.  Even now, I don't understand
> > how I've misunderstood it.
> 
> huh? Still missing 'unprivileged' in the above ?
> and completely ignoring the rest of the paragraph in the link above?

Are you saying that unprivileged programs are not allowed to allocate
memory?  Or that there is a limit on the amount of heap memory that
unprivileged programs are allowed to allocate.

> > > > > bpf progs are pretty close to be at parity with kernel modules.
> > > > > Except that they are safe, portable, and users have full visibility into them.
> > > > > It's not a blob of bytes unlike .ko.
> > > > 
> > > > It doesn't seem unreasonable to expect them to behave like kernel
> > > > modules, then.  If they want to allocate memory in NMI context, then
> > > > they should get to preallocate it before they go into NMI context.
> > > 
> > > You're still missing 'any context' part from the previous email.
> > 
> > Really, this is not a productive way to respond.  I want to help
> > and you're just snarling at me.
> 
> To help you need to understand what bpf is while you're failing
> to read the doc.

Part of working with other people is understanding that they don't know
as much as you do about your thing, and at the same time understanding
that you don't know as much as they do about their thing.  That means
explaining things in a way which makes sense to them instead of getting
all huffy when they don't understand the details of your thing.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux