On Thu, Jan 23, 2025 at 07:56:51PM -0800, Alexei Starovoitov wrote: > From: Alexei Starovoitov <ast@xxxxxxxxxx> > > Introduce free_pages_nolock() that can free pages without taking locks. > It relies on trylock and can be called from any context. > Since spin_trylock() cannot be used in PREEMPT_RT from hard IRQ or NMI > it uses lockless link list to stash the pages which will be freed > by subsequent free_pages() from good context. > > Do not use llist unconditionally. BPF maps continuously > allocate/free, so we cannot unconditionally delay the freeing to > llist. When the memory becomes free make it available to the > kernel and BPF users right away if possible, and fallback to > llist as the last resort. > > Acked-by: Vlastimil Babka <vbabka@xxxxxxx> > Acked-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> > Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx> Reviewed-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>