Subject: Re: [PATCH] sky2: skb recycling

From: Eric Dumazet <[email-masked]>
Date: Tue, 21 Oct 2008 11:53:58 +0200

Robert Olsson a écrit :
> Eric Dumazet writes:
>  > Stephen Hemminger a écrit :
>  > > Add support for recycling tx buffers into receive buffers.
>  > > This is experimental at this point.
>  > > 
>  > 
>  > I really like this skb recycling
> 
> Hi,
> 
> Well the best and cleanest thing would be if the "global" recycler slab/slub 
> was fast enough. Historically it seems like every time the link speed increases 
> (now to 10g) alloc/kfree pops up on the profiles but that challenge has sofar
> been handled by slab/slub folks. Maybe we should consult them first...

Yes, but typical problem is inbalance :

One CPU does the allocations, (interrupts handled by a given CPU)
Another CPU(s) do(es) the freeing

Such scenario is hard for slab/slub because it needs inter-CPU communication, while
slub/slab are optimized to deal with per CPU queues/structures (fast path)

skb recycling is an interesting technique because typical NIC handles RX & TX completion
in one CPU at the same time, thus we can reduce this slab/slub inter-CPU handling.

> 
> Also there was some discussions to have packet objects in slab.
>

skb recycling has a (nice ?) side effect on NUMA platforms, not for forwarding workloads,
(which are IMHO not the majority of linux machines workloads) but typical servers.

Current NIC drivers actually allocate their RX rings using the memory node
close to the device.

With RX recycling, we are re-using skb that were allocated by the process itself,
and this process is likely the one that will process received frames.

On loaded machines, I am not sure that NIC having to access to remote nodes is
the limiting factor, especially considering modern coalescing/mitigation that tends to
delay interrupts anyway (and thus notification to host)