Skip to content

Commit a682850

Browse files
edumazetdavem330
authored andcommitted
tcp: get rid of tcp_tso_should_defer() dependency on HZ/jiffies
tcp_tso_should_defer() first heuristic is to not defer if last send is "old enough". Its current implementation uses jiffies and its low granularity. TSO autodefer performance should not rely on kernel HZ :/ After EDT conversion, we have state variables in nanoseconds that can allow us to properly implement the heuristic. This patch increases TSO chunk sizes on medium rate flows, especially when receivers do not use GRO or similar aggregation. It also reduces bursts for HZ=100 or HZ=250 kernels, making TCP behavior more uniform. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f1c6ea3 commit a682850

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

net/ipv4/tcp_output.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,9 +1920,12 @@ static bool tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb,
19201920
goto send_now;
19211921

19221922
/* Avoid bursty behavior by allowing defer
1923-
* only if the last write was recent.
1923+
* only if the last write was recent (1 ms).
1924+
* Note that tp->tcp_wstamp_ns can be in the future if we have
1925+
* packets waiting in a qdisc or device for EDT delivery.
19241926
*/
1925-
if ((s32)(tcp_jiffies32 - tp->lsndtime) > 0)
1927+
delta = tp->tcp_clock_cache - tp->tcp_wstamp_ns - NSEC_PER_MSEC;
1928+
if (delta > 0)
19261929
goto send_now;
19271930

19281931
in_flight = tcp_packets_in_flight(tp);

0 commit comments

Comments
 (0)