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

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

 



On Tue 12-07-22 11:40:18, Alexei Starovoitov wrote:
> On Tue, Jul 12, 2022 at 09:40:13AM +0200, Michal Hocko wrote:
> > On Mon 11-07-22 21:39:14, Alexei Starovoitov wrote:
> > > On Mon, Jul 11, 2022 at 02:15:07PM +0200, Michal Hocko wrote:
> > > > On Sun 10-07-22 07:32:13, Shakeel Butt wrote:
> > > > > On Sat, Jul 09, 2022 at 10:26:23PM -0700, Alexei Starovoitov wrote:
> > > > > > On Fri, Jul 8, 2022 at 2:55 PM Shakeel Butt <shakeelb@xxxxxxxxxx> wrote:
> > > > > [...]
> > > > > > >
> > > > > > > Most probably Michal's comment was on free objects sitting in the caches
> > > > > > > (also pointed out by Yosry). Should we drain them on memory pressure /
> > > > > > > OOM or should we ignore them as the amount of memory is not significant?
> > > > > > 
> > > > > > Are you suggesting to design a shrinker for 0.01% of the memory
> > > > > > consumed by bpf?
> > > > > 
> > > > > No, just claim that the memory sitting on such caches is insignificant.
> > > > 
> > > > yes, that is not really clear from the patch description. Earlier you
> > > > have said that the memory consumed might go into GBs. If that is a
> > > > memory that is actively used and not really reclaimable then bad luck.
> > > > There are other users like that in the kernel and this is not a new
> > > > problem. I think it would really help to add a counter to describe both
> > > > the overall memory claimed by the bpf allocator and actively used
> > > > portion of it. If you use our standard vmstat infrastructure then we can
> > > > easily show that information in the OOM report.
> > > 
> > > OOM report can potentially be extended with info about bpf consumed
> > > memory, but it's not clear whether it will help OOM analysis.
> > 
> > If GBs of memory can be sitting there then it is surely an interesting
> > information to have when seeing OOM. One of the big shortcomings of the
> > OOM analysis is unaccounted memory.
> > 
> > > bpftool map show
> > > prints all map data already.
> > > Some devs use bpf to inspect bpf maps for finer details in run-time.
> > > drgn scripts pull that data from crash dumps.
> > > There is no need for new counters.
> > > The idea of bpf specific counters/limits was rejected by memcg folks.
> > 
> > I would argue that integration into vmstat is useful not only for oom
> > analysis but also for regular health check scripts watching /proc/vmstat
> > content. I do not think most of those generic tools are BPF aware. So
> > unless there is a good reason to not account this memory there then I
> > would vote for adding them. They are cheap and easy to integrate.
> 
> We've seen enough performance issues with such counters.

Not sure we are talking about the same thing. These counters are used by
the page allocator as well (e.g. PGALLOC, PGFREE) without a noticeable
overhead.

> So, no, they are not cheap.
> Remember bpf has to be optimized for all cases.
> Some of them process millions of packets per second.
> Others do millions of map update/delete per second which means
> millions of alloc/free.

I thought the whole point is to allocate from a different context than
the one where the memory is used.

In any case, these were my few cents to help with "usual pains when OOM
is hit". I can see you are not much into discussing in more details so
I won't burn much more of our time here.

Let me just reiterate that OOM reports with a large part of the
consumption outside of usual counters are a PITA and essentially
undebuggable without a local reproducer which can get pretty tricky with
custom eBPF programs running on the affected system you do not have
access to. So I believe that large in-kernel memory consumers should
be accounted somewhere so it is at least clear where one should look
for. If numbers tell that the accounting is prohibitely expensive than
it would be great to have an estimation at least.

Thanks

-- 
Michal Hocko
SUSE Labs



[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