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.

tcp: reduce calls to tcp_schedule_loss_probe()

For RPC workloads, we alternate tcp_schedule_loss_probe() calls from
output path and from input path, with tp->packets_out value
oscillating between !zero and zero, leading to poor branch prediction.

Move tp->packets_out check from tcp_schedule_loss_probe() to
tcp_set_xmit_timer().

We avoid one call to tcp_schedule_loss_probe() from tcp_ack()
path for typical RPC workloads, while improving branch prediction.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260223113501.4070245-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
fca59a2d a09eb622

+2 -2
+1 -1
net/ipv4/tcp_input.c
··· 3552 3552 /* Try to schedule a loss probe; if that doesn't work, then schedule an RTO. */ 3553 3553 static void tcp_set_xmit_timer(struct sock *sk) 3554 3554 { 3555 - if (!tcp_schedule_loss_probe(sk, true)) 3555 + if (!tcp_sk(sk)->packets_out || !tcp_schedule_loss_probe(sk, true)) 3556 3556 tcp_rearm_rto(sk); 3557 3557 } 3558 3558
+1 -1
net/ipv4/tcp_output.c
··· 3135 3135 * not in loss recovery, that are either limited by cwnd or application. 3136 3136 */ 3137 3137 if ((early_retrans != 3 && early_retrans != 4) || 3138 - !tp->packets_out || !tcp_is_sack(tp) || 3138 + !tcp_is_sack(tp) || 3139 3139 (icsk->icsk_ca_state != TCP_CA_Open && 3140 3140 icsk->icsk_ca_state != TCP_CA_CWR)) 3141 3141 return false;