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

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

 



On Wed, Jul 6, 2022 at 5:25 PM Roman Gushchin <roman.gushchin@xxxxxxxxx> wrote:
>
> On Thu, Jul 07, 2022 at 12:07:21AM +0000, Shakeel Butt wrote:
> > On Wed, Jul 06, 2022 at 03:58:47PM +0000, Yafang Shao 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.
> >
> > Please use GFP_NOWAIT instead of (__GFP_ATOMIC | __GFP_KSWAPD_RECLAIM).
> > There is already a plan to completely remove __GFP_ATOMIC and mm-tree
> > already have a patch for that.
>
> Oh, I didn't know this, thanks for heads up!
> I agree that GFP_NOWAIT is the best choice then.
>
> Btw, we probably shouldn't even add GFP_NOWAIT if the allocation is performed
> from the bpf syscall context. Why would we fail to pre-allocate a map if
> we can easily go into the reclaim? But probably better to leave it for
> a separate change.

The places affected by this patch are in atomic context.
Prealloc path from syscall is using GFP_USER.




[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