Re: [PATCH] net: skip RPS if packet is already on target CPU
From: Eric Dumazet
Date: Tue Oct 29 2024 - 15:02:40 EST
On Tue, Oct 29, 2024 at 7:27 PM Caleb Sander Mateos
<csander@xxxxxxxxxxxxxxx> wrote:
>
> If RPS is enabled, all packets with a CPU flow hint are enqueued to the
> target CPU's input_pkt_queue and process_backlog() is scheduled on that
> CPU to dequeue and process the packets. If ARFS has already steered the
> packets to the correct CPU, this additional queuing is unnecessary and
> the spinlocks involved incur significant CPU overhead.
>
> In netif_receive_skb_internal() and netif_receive_skb_list_internal(),
> check if the CPU flow hint get_rps_cpu() returns is the current CPU. If
> so, bypass input_pkt_queue and immediately process the packet(s) on the
> current CPU.
>
> Signed-off-by: Caleb Sander Mateos <csander@xxxxxxxxxxxxxxx>
Current implementation was a conscious choice. This has been discussed
several times.
By processing packets inline, you are actually increasing latencies of
packets queued to other cpus.