tcp_cubic: optimize hystart_update()
We do not care which bit in ca->found is set. We avoid accessing hystart and hystart_detect unless really needed, possibly avoiding one cache line miss. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2bbc078f81
commit
473900a504
|
@ -381,9 +381,6 @@ static void hystart_update(struct sock *sk, u32 delay)
|
||||||
struct tcp_sock *tp = tcp_sk(sk);
|
struct tcp_sock *tp = tcp_sk(sk);
|
||||||
struct bictcp *ca = inet_csk_ca(sk);
|
struct bictcp *ca = inet_csk_ca(sk);
|
||||||
|
|
||||||
if (ca->found & hystart_detect)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (hystart_detect & HYSTART_ACK_TRAIN) {
|
if (hystart_detect & HYSTART_ACK_TRAIN) {
|
||||||
u32 now = bictcp_clock();
|
u32 now = bictcp_clock();
|
||||||
|
|
||||||
|
@ -391,7 +388,7 @@ static void hystart_update(struct sock *sk, u32 delay)
|
||||||
if ((s32)(now - ca->last_ack) <= hystart_ack_delta) {
|
if ((s32)(now - ca->last_ack) <= hystart_ack_delta) {
|
||||||
ca->last_ack = now;
|
ca->last_ack = now;
|
||||||
if ((s32)(now - ca->round_start) > ca->delay_min >> 4) {
|
if ((s32)(now - ca->round_start) > ca->delay_min >> 4) {
|
||||||
ca->found |= HYSTART_ACK_TRAIN;
|
ca->found = 1;
|
||||||
NET_INC_STATS(sock_net(sk),
|
NET_INC_STATS(sock_net(sk),
|
||||||
LINUX_MIB_TCPHYSTARTTRAINDETECT);
|
LINUX_MIB_TCPHYSTARTTRAINDETECT);
|
||||||
NET_ADD_STATS(sock_net(sk),
|
NET_ADD_STATS(sock_net(sk),
|
||||||
|
@ -412,7 +409,7 @@ static void hystart_update(struct sock *sk, u32 delay)
|
||||||
} else {
|
} else {
|
||||||
if (ca->curr_rtt > ca->delay_min +
|
if (ca->curr_rtt > ca->delay_min +
|
||||||
HYSTART_DELAY_THRESH(ca->delay_min >> 3)) {
|
HYSTART_DELAY_THRESH(ca->delay_min >> 3)) {
|
||||||
ca->found |= HYSTART_DELAY;
|
ca->found = 1;
|
||||||
NET_INC_STATS(sock_net(sk),
|
NET_INC_STATS(sock_net(sk),
|
||||||
LINUX_MIB_TCPHYSTARTDELAYDETECT);
|
LINUX_MIB_TCPHYSTARTDELAYDETECT);
|
||||||
NET_ADD_STATS(sock_net(sk),
|
NET_ADD_STATS(sock_net(sk),
|
||||||
|
@ -450,7 +447,7 @@ static void bictcp_acked(struct sock *sk, const struct ack_sample *sample)
|
||||||
ca->delay_min = delay;
|
ca->delay_min = delay;
|
||||||
|
|
||||||
/* hystart triggers when cwnd is larger than some threshold */
|
/* hystart triggers when cwnd is larger than some threshold */
|
||||||
if (hystart && tcp_in_slow_start(tp) &&
|
if (!ca->found && hystart && tcp_in_slow_start(tp) &&
|
||||||
tp->snd_cwnd >= hystart_low_window)
|
tp->snd_cwnd >= hystart_low_window)
|
||||||
hystart_update(sk, delay);
|
hystart_update(sk, delay);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue