On Mon, Jun 26, 2023 at 10:59:40AM -0700, Alexei Starovoitov wrote: > On Mon, Jun 26, 2023 at 10:55 AM David Vernet <void@xxxxxxxxxxxxx> wrote: > > > > > > > + > > > > > + migrate_disable(); > > > > > + bpf_mem_cache_free_rcu(&bpf_cpumask_ma, cpumask); > > > > > + migrate_enable(); > > > > > > > > The fact that callers have to disable migration like this in order to > > > > safely free the memory feels a bit leaky. Is there any reason we can't > > > > move this into bpf_mem_{cache_}free_rcu()? > > > > > > migrate_disable/enable() are actually not necessary here. > > > We can call bpf_mem_cache_free_rcu() directly from any kfunc. > > > > Could you please clarify why? Can't we migrate if the kfunc is called > > from a sleepable struct_ops callback? > > migration is disabled for all bpf progs including sleepable. Fair enough :-) Then yep, let's remove these. Feel free to do so when you send v2, and keep my Ack. Otherwise I'm happy to send a follow-on patch after this series is merged.