Re: [PATCH bpf] bpf/helpers: Use __GFP_HIGH instead of GFP_ATOMIC in __bpf_async_init()

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

 



On Mon, Sep 08, 2025 at 10:32:29AM -0700, Shakeel Butt wrote:
> On Fri, Sep 05, 2025 at 11:45:46PM +0000, Peilin Ye wrote:
> > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> > index b9b0c5fe33f6..508b13c24778 100644
> > --- a/kernel/bpf/helpers.c
> > +++ b/kernel/bpf/helpers.c
> > @@ -1274,8 +1274,14 @@ static int __bpf_async_init(struct bpf_async_kern *async, struct bpf_map *map, u
> >  		goto out;
> >  	}
> >  
> > -	/* allocate hrtimer via map_kmalloc to use memcg accounting */
> > -	cb = bpf_map_kmalloc_node(map, size, GFP_ATOMIC, map->numa_node);
> > +	/* Allocate via bpf_map_kmalloc_node() for memcg accounting. Use
> > +	 * __GFP_HIGH instead of GFP_ATOMIC to avoid calling
> > +	 * cgroup_file_notify() if an MEMCG_MAX event is raised by
> > +	 * try_charge_memcg(). This prevents various locking issues, including
> > +	 * double-acquiring locks that may already be held here (e.g.,
> > +	 * cgroup_file_kn_lock, rq_lock).
> 
> Too much unnecessary information in the comment. Just mention that we
> want nolock allocations and for that we need to remove __GFP_RECLAIM
> flags until nolock allocation interfaces are available.

Got it - I'll reword in v2.

Thanks,
Peilin Ye





[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