Re: [PATCH net-next 1/3] net: netpoll: Defer skb_pool population until setup success

From: Jakub Kicinski
Date: Fri Nov 01 2024 - 22:01:11 EST


On Fri, 1 Nov 2024 11:18:29 -0700 Breno Leitao wrote:
> > I think that a best mechanism might be something like:
> >
> > * If find_skb() needs to consume from the pool (which is rare, only
> > when alloc_skb() fails), raise workthread that tries to repopulate the
> > pool in the background.
> >
> > * Eventually avoid alloc_skb() first, and getting directly from the
> > pool first, if the pool is depleted, try to alloc_skb(GPF_ATOMIC).
> > This might make the code faster, but, I don't have data yet.
>
> I've hacked this case (getting the skb from the pool first and refilling
> it on a workqueue) today, and the performance is expressive.
>
> I've tested sending 2k messages, and meassured the time it takes to
> run `netpoll_send_udp`, which is the critical function in netpoll.

The purpose of the pool is to have a reserve in case of OOM, AFAIU.
We may speed things up by taking the allocations out of line but
we risk the pool being empty when we really need it.