From: David Miller <davem@davemloft.net>
To: laoar.shao@gmail.com
Cc: edumazet@google.com, yanhaishuang@cmss.chinamobile.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] tcp: fix the calculation of sysctl_max_tw_buckets in tcp_sk_init()
Date: Mon, 06 Aug 2018 13:41:16 -0700 (PDT) [thread overview]
Message-ID: <20180806.134116.1016660959593702560.davem@davemloft.net> (raw)
In-Reply-To: <1533556020-20778-1-git-send-email-laoar.shao@gmail.com>
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.
next prev parent reply other threads:[~2018-08-06 20:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-06 11:47 [PATCH net-next] tcp: fix the calculation of sysctl_max_tw_buckets in tcp_sk_init() Yafang Shao
2018-08-06 20:41 ` David Miller [this message]
2018-08-07 1:40 ` Yafang Shao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180806.134116.1016660959593702560.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=laoar.shao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yanhaishuang@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).