]> Gentwo Git Trees - linux/.git/commit
net: optimize enqueue_to_backlog() for the fast path
authorEric Dumazet <edumazet@google.com>
Fri, 24 Oct 2025 09:05:17 +0000 (09:05 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 29 Oct 2025 00:39:03 +0000 (17:39 -0700)
commita086e9860ce6a751acd71dbec54d24a819dd6baa
treea8edcf4bf42d4f2cc0f7f465a55f4496f922d818
parent34164142b5fd6878cd487f531ae074e3227031ac
net: optimize enqueue_to_backlog() for the fast path

Add likely() and unlikely() clauses for the common cases:

Device is running.
Queue is not full.
Queue is less than half capacity.

Add max_backlog parameter to skb_flow_limit() to avoid
a second READ_ONCE(net_hotdata.max_backlog).

skb_flow_limit() does not need the backlog_lock protection,
and can be called before we acquire the lock, for even better
resistance to attacks.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20251024090517.3289181-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/dev.c