On Tue, 2016-09-27 at 09:06 -0700, Lawrence Brakmo wrote:
> The current code changes txhash (flowlables) on every retransmitted
> SYN/ACK, but only after the 2nd retransmitted SYN and only after
> tcp_retries1 RTO retransmits.
> 
> With this patch:
> 1) txhash is changed with every SYN retransmist
> 2) adds the option for the txhash to be changed before tcp_retries1
>    RTO retransmits. A new sysctl tcp_rto_txhash_prob represents the
>    probability that txhash will be changed. The default value is 0
>    which maintains previous behavior and a value of 100 will always
>    change it.

...

> @@ -213,6 +215,11 @@ static int tcp_write_timeout(struct sock *sk)
>                       tcp_mtu_probing(icsk, sk);
>  
>                       dst_negative_advice(sk);
> +             } else if (sk->sk_txhash && sysctl_tcp_rto_txhash_prob > 0) {
> +                     u32 v = prandom_u32() % 100;
> +
> +                     if (v < sysctl_tcp_rto_txhash_prob)
> +                             sk_set_txhash(sk);
>  

Write timeouts are rare events and sk_txhash should already be set.

Also prandom_u32_max() is a bit faster (no divide, and even no multiply
for 100 which is 5*5*4, compiler can emit 2 lea instructions )

I would suggest not using all these tests and instead be very simple :

        } else if (prandom_u32_max(100) < sysctl_tcp_rto_txhash_prob) {
                sk_set_txhash(sk);
        }

Finally, adding a new sysctl requires a Documentation update
( Documentation/networking/ip-sysctl.txt )

Thanks.



Reply via email to