Re: [PATCH bpf-next v3 1/2] bpf: Make non-preallocated allocation low priority

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

 



On Tue, Jul 12, 2022 at 05:49:24PM -0700, Alexei Starovoitov wrote:
> On Mon, Jul 11, 2022 at 12:19 PM Shakeel Butt <shakeelb@xxxxxxxxxx> wrote:
> >
> > On Sat, Jul 9, 2022 at 8:45 AM Yafang Shao <laoar.shao@xxxxxxxxx> wrote:
> > >
> > > GFP_ATOMIC doesn't cooperate well with memcg pressure so far, especially
> > > if we allocate too much GFP_ATOMIC memory. For example, when we set the
> > > memcg limit to limit a non-preallocated bpf memory, the GFP_ATOMIC can
> > > easily break the memcg limit by force charge. So it is very dangerous to
> > > use GFP_ATOMIC in non-preallocated case. One way to make it safe is to
> > > remove __GFP_HIGH from GFP_ATOMIC, IOW, use (__GFP_ATOMIC |
> > > __GFP_KSWAPD_RECLAIM) instead, then it will be limited if we allocate
> > > too much memory. There's a plan to completely remove __GFP_ATOMIC in the
> > > mm side[1], so let's use GFP_NOWAIT instead.
> > >
> > > We introduced BPF_F_NO_PREALLOC is because full map pre-allocation is
> > > too memory expensive for some cases. That means removing __GFP_HIGH
> > > doesn't break the rule of BPF_F_NO_PREALLOC, but has the same goal with
> > > it-avoiding issues caused by too much memory. So let's remove it.
> > >
> > > This fix can also apply to other run-time allocations, for example, the
> > > allocation in lpm trie, local storage and devmap. So let fix it
> > > consistently over the bpf code
> > >
> > > It also fixes a typo in the comment.
> > >
> > > [1]. https://lore.kernel.org/linux-mm/163712397076.13692.4727608274002939094@xxxxxxxxxxxxxxxxxxxxx/
> > >
> > > Cc: Roman Gushchin <roman.gushchin@xxxxxxxxx>
> > > Cc: Shakeel Butt <shakeelb@xxxxxxxxxx>
> > > Cc: NeilBrown <neilb@xxxxxxx>
> > > Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
> >
> > Reviewed-by: Shakeel Butt <shakeelb@xxxxxxxxxx>
> 
> Applied to bpf-next.

Looks like I'm a bit late to the party, but my ack still applies.

Thanks!




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux