lkml.org 
[lkml]   [2018]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH net-next] tcp: fix the calculation of sysctl_max_tw_buckets in tcp_sk_init()
From
From: Yafang Shao <laoar.shao@gmail.com>
Date: Mon, 6 Aug 2018 19:47:00 +0800

> tcp_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.
>
> Maybe the compiler could also optimize it, but this code is a little ugly.
>
> Fix: fee83d09 ("ipv4: Namespaceify tcp_max_syn_backlog knob")

The correct tag is "Fixes: "

> @@ -2543,7 +2543,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;

This is completely harmless, and does no harm.

You aren't "fixing" anything.

\
 
 \ /
  Last update: 2018-08-06 22:42    [W:0.096 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site