Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp360748imm; Sat, 1 Sep 2018 05:22:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZW/eN07oyH+W9goKXDDZEOFCkIwCbKLb6dWhwVgkQhc+BJCHjbrS6gfqp3lhv9TssILduu X-Received: by 2002:a63:4f14:: with SMTP id d20-v6mr18435389pgb.121.1535804570396; Sat, 01 Sep 2018 05:22:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535804570; cv=none; d=google.com; s=arc-20160816; b=FjVlM0R3hk/rmtVehaBJDkDSfmGqY/663a2jqnuN4eBFSr6IjFJtPbmPvcWPTif8VB 9BWUB/JOgU1VN1koOAbQX3Ji7FQg6rdhRuoM6oJeTxh1nrs3SUf2NkYETvpMJ5fLT0dZ +yr5izcOoienJPcQNmNAT+q+VKXC60oYIq6YEVLTGng0x4aUcsZFdcG9QEXLfZaro9QC o421PWwaQidaKIw7tFHOTmY2AZ8w7TrNdqdw40WbDIEKHIoaMLaBmfwqG4Qs6F8YaETf z/ZBJ3O8F2OhkjFSf6YvLG5a8l+79/sThO1sOfx9m8JViaeH8Q9WTOLlnb+v1tBifcMd 9H0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=GNtbETmUhFnTOzHv72I2Ebs2X16NzbVqsBREibxEVF4=; b=v/HIdyv9eRDZu/TDSt9J1lQ9SqgiNrflhz3C98O4Ue3oRuZECpTWePvhE0QWfC9LB5 RxKJbO0MUFe+RdOwLehMQk5CcUGpPXMEPhZRNV5LikyC6PoNXuGpBWBkJu2jM2apc1EK lJ2VFpP+4coY4MRJkC8qWwWN4Q7K4W/fVhn/sdGGq0qmN8QfAc9ppUI49l5zbUyz4452 6pVm8ZkzFHAZobRn96AIdoN2iWv9xI4sf6/qShHm4WtnirqbTpU9r3aqgzI7LYS2T6Iu 5yP/lxH0Ozlpd+NHt0RwpSjLh8qJMaFQSUYf/PYuxLeBEbr/nAfuOk7wM3aSAYmJ5tbV fZnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bokOuGDM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3-v6si12087118pld.329.2018.09.01.05.22.36; Sat, 01 Sep 2018 05:22:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bokOuGDM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727485AbeIAQdY (ORCPT + 99 others); Sat, 1 Sep 2018 12:33:24 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:36663 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726825AbeIAQdY (ORCPT ); Sat, 1 Sep 2018 12:33:24 -0400 Received: by mail-pf1-f196.google.com with SMTP id b11-v6so6717856pfo.3; Sat, 01 Sep 2018 05:21:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GNtbETmUhFnTOzHv72I2Ebs2X16NzbVqsBREibxEVF4=; b=bokOuGDMqO7nEMjGEzaScLCLDvlzpD1Fkiv0f7QosUly05uwzyV9FGf2ht+AkgF5GZ 4oBzp0wS5s7/aA6kRSDw8GGobJOIHoGkdZVz6Q1tnO3MlNBcFqA4X0v9YhcGnFb9lCkp UEdXTR654mR250sjP8xiKvcvz+xJ197ATk777KONVa+VjnbjfiUbdkHzs49nmo2EXmBp XGejDR3/tkjeSiCveBiv2DAxshf6DaYTkL1E9IqtInw6CQQ/ColpZ1Ly8+uslPMy1Yg8 LjJHQZuIVGsy/SIvO6XyMcGPiVojy8sDKVmaO3t3lTAjaygo7WF5spDADG4SgsqUIqDL kZeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GNtbETmUhFnTOzHv72I2Ebs2X16NzbVqsBREibxEVF4=; b=B3aI9dY2tBvPC+azXchF17ECPGl/iK4ulX4WCHVRkk6Z0b7DRSj5HJRzc4xZpe/8/P XIHEr4XijSMkhuin5l/fXlqMEtY3BiOyOwTXHNL+zEycvVjcJrxo6UAaQRzamDSHQkEe xQlIKq/y9xH3Bk7oXIXHIKL9VYSOVb6njXT0rY8uYpqIAl1Omwuc8b7SBT5z9a2q9rEv Asugi+UFJJbC+9EEkQASajlbN1uA9h8LG8KtEGAfFwrIpn3kCbpp9fmHugX1gxWQhff6 8AYzGkX1lGV1Wh8m5AVznfhqwIicxt1Dc4HjLFZtESJSeDTsMUw1J8KtML/aYwVslWnf S9zQ== X-Gm-Message-State: APzg51BYEZ5T2SJMICKNcNTi3mKHtSII2hexS8DDzvk///y2mb53HkFu hHIiVkXSLVbSJz8TSHwD4sI= X-Received: by 2002:a62:be03:: with SMTP id l3-v6mr20502131pff.138.1535804492003; Sat, 01 Sep 2018 05:21:32 -0700 (PDT) Received: from bogon.didichuxing.com ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id z19-v6sm22454043pgi.33.2018.09.01.05.21.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Sep 2018 05:21:31 -0700 (PDT) From: Yafang Shao To: edumazet@google.com, davem@davemloft.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yafang Shao Subject: [PATCH net-next] tcp: remove useless add operation when init sysctl_max_tw_buckets Date: Sat, 1 Sep 2018 20:21:05 +0800 Message-Id: <1535804465-11795-2-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1535804465-11795-1-git-send-email-laoar.shao@gmail.com> References: <1535804465-11795-1-git-send-email-laoar.shao@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- net/ipv4/tcp_ipv4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 44c09ed..09547ef 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -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); -- 1.8.3.1