Re: [PATCH net-next] net: core: Call netif_get_rxqueue() in get_rps_cpu()

From: Eric Dumazet

Date: Wed Apr 29 2026 - 08:36:40 EST


On Wed, Apr 29, 2026 at 5:15 AM Yue Haibing <yuehaibing@xxxxxxxxxx> wrote:
>
> Refactor netif_get_rxqueue() return NULL when rxq index checking failed
> instead of falling back to first queue, then use it to avoid code
> duplication.
>
> Signed-off-by: Yue Haibing <yuehaibing@xxxxxxxxxx>
> ---
> net/core/dev.c | 24 +++++++++---------------
> 1 file changed, 9 insertions(+), 15 deletions(-)
>

This code (get_rps_cpu()) is super hot for some of us.

Are you sure netif_get_rxqueue() is kept inline?

I do not think gcc is smart enough:

scripts/bloat-o-meter -t net/core/dev.o.before net/core/dev.o.after
add/remove: 1/0 grow/shrink: 2/2 up/down: 116/-132 (-16)
Function old new delta
netif_get_rxqueue.isra - 84 +84
dev_getbyhwaddr_rcu 133 149 +16
__netif_set_xps_queue 2837 2853 +16
bpf_prog_run_generic_xdp 899 846 -53
get_rps_cpu 835 756 -79
// This is bad,
Total: Before=90848, After=90832, chg -0.02%