Message ID | 20210209192028.3350290-3-eric.dumazet@gmail.com |
---|---|
State | New |
Headers | show |
Series | tcp: RFC 6056 induced changes | expand |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 12808dac923a4c29cb152201140757c69ba165e5..c96866a53a664601fdb8904f486cc590675ae34f 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -818,6 +818,11 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row, return -EADDRNOTAVAIL; ok: + /* If our first attempt found a candidate, skip next candidate + * in 1/16 of cases to add some noise. + */ + if (!i && !(prandom_u32() % 16)) + i = 2; WRITE_ONCE(table_perturb[index], READ_ONCE(table_perturb[index]) + i + 2); /* Head lock still held and bh's disabled */