On Thu, Jul 7, 2022 at 3:28 AM Yafang Shao <laoar.shao@xxxxxxxxx> wrote: > > On Thu, Jul 7, 2022 at 8:07 AM Shakeel Butt <shakeelb@xxxxxxxxxx> 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. > > > > After reading the discussion[1], it looks good to me to use GFP_NOWAIT > instead. I will update it. Should we use GFP_ATOMIC | __GFP_NOMEMALLOC instead to align with its usage in the networking stack?