Skip to content

Commit

Permalink
tcp: remove useless add operation when init sysctl_max_tw_buckets
Browse files Browse the repository at this point in the history
cp_hashinfo.ehash_mask is always an odd number, which is set in function
alloc_large_system_hash(). See bellow,
        if (_hash_mask)
                *_hash_mask = (1 << log2qty) - 1; <<< always odd number

Hence the local variable 'cnt' is a even number, as a result of that it is
no difference to do the incrementation here.

Signed-off-by: Yafang Shao <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
laoar authored and davem330 committed Sep 2, 2018
1 parent 1914104 commit 743e481
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv4/tcp_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -2549,7 +2549,7 @@ static int __net_init tcp_sk_init(struct net *net)
net->ipv4.sysctl_tcp_tw_reuse = 2;

cnt = tcp_hashinfo.ehash_mask + 1;
net->ipv4.tcp_death_row.sysctl_max_tw_buckets = (cnt + 1) / 2;
net->ipv4.tcp_death_row.sysctl_max_tw_buckets = cnt / 2;
net->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo;

net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 256);
Expand Down

0 comments on commit 743e481

Please sign in to comment.