Re: [RFC PATCH bpf-next 00/10] bpf, mm: Recharge pages when reuse bpf map

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

 



On Sun, Jun 26, 2022 at 02:25:51PM +0800, Yafang Shao wrote:
> > >                                              htab->map.numa_node);
> > > And then we'd better introduce an improvement for memcg,
> > > +      /*
> > > +       *  Should wakeup async memcg reclaim first,
> > > +       *   in case there will be no direct memcg reclaim for a long time.
> > > +       *   We can either introduce async memcg reclaim
> > > +       *   or modify kswapd to reclaim a specific memcg
> > > +       */
> > > +       if (gfp_mask & __GFP_KSWAPD_RECLAIM)
> > > +            wake_up_async_memcg_reclaim();
> > >          if (!gfpflags_allow_blocking(gfp_mask))
> > >                 goto nomem;
> >
> > Hm, I see. It might be an issue if there is no global memory pressure, right?
> > Let me think what I can do here too.
> >
> 
> Right. It is not a good idea to expect a global memory reclaimer to do it.
> Thanks for following up with it again.

After thinking a bit more, I'm not sure if it's actually a good idea:
there might be not much memory to reclaim except the memory consumed by the bpf
map itself, so waking kswapd might be useless (and just consume cpu and drain
batteries).

What we need to do instead is to prevent bpf maps to meaningfully exceed
memory.max, which is btw guaranteed by the cgroup API: memory.max is defined
as a hard limit in docs. Your recent patch is actually doing this for hash maps,
let's fix the rest of the bpf code.

Thanks!



[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