Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net_sched: sch_fq: tweak unlikely() hints in fq_dequeue()

After 076433bd78d7 ("net_sched: sch_fq: add fast path
for mostly idle qdisc") we need to remove one unlikely()
because q->internal holds all the fast path packets.

skb = fq_peek(&q->internal);
if (unlikely(skb)) {
q->internal.qlen--;

Calling INET_ECN_set_ce() is very unlikely.

These changes allow fq_dequeue_skb() to be (auto)inlined,
thus making fq_dequeue() faster.

$ scripts/bloat-o-meter -t vmlinux.0 vmlinux
add/remove: 2/2 grow/shrink: 0/1 up/down: 283/-269 (14)
Function old new delta
INET_ECN_set_ce - 267 +267
__pfx_INET_ECN_set_ce - 16 +16
__pfx_fq_dequeue_skb 16 - -16
fq_dequeue_skb 103 - -103
fq_dequeue 1685 1535 -150
Total: Before=24886569, After=24886583, chg +0.00%

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://patch.msgid.link/20260203214716.880853-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
acd21dd2 f8a062b2

+2 -2
+2 -2
net/sched/sch_fq.c
··· 665 665 return NULL; 666 666 667 667 skb = fq_peek(&q->internal); 668 - if (unlikely(skb)) { 668 + if (skb) { 669 669 q->internal.qlen--; 670 670 fq_dequeue_skb(sch, &q->internal, skb); 671 671 goto out; ··· 716 716 } 717 717 prefetch(&skb->end); 718 718 fq_dequeue_skb(sch, f, skb); 719 - if ((s64)(now - time_next_packet - q->ce_threshold) > 0) { 719 + if (unlikely((s64)(now - time_next_packet - q->ce_threshold) > 0)) { 720 720 INET_ECN_set_ce(skb); 721 721 q->stat_ce_mark++; 722 722 }