From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH v4 2/2] sock: Move the socket inuse to namespace. Date: Sat, 25 Nov 2017 23:53:02 +0900 (KST) Message-ID: <20171125.235302.781017870270039369.davem@davemloft.net> References: <1511401885-3686-1-git-send-email-xiangxia.m.yue@gmail.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, xiyou.wangcong@gmail.com To: xiangxia.m.yue@gmail.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:50790 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751583AbdKYOxG (ORCPT ); Sat, 25 Nov 2017 09:53:06 -0500 In-Reply-To: <1511401885-3686-1-git-send-email-xiangxia.m.yue@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Tonghao Zhang Date: Wed, 22 Nov 2017 17:51:25 -0800 > This patch add a member in struct netns_core. And this is > a counter for socket_inuse in the _net_ namespace. The patch > will add/sub counter in the sk_alloc or sk_free. Because socket and > sock is in pair. It's a easy way to maintain the code and help > developer to review. More important, it avoids holding the _net_ > namespace again. > > Signed-off-by: Martin Zhang > Signed-off-by: Tonghao Zhang First, it is extremely unclear why this is better. You do not explain the reason at all. Second: > @@ -2646,17 +2646,8 @@ static int __init sock_init(void) > #ifdef CONFIG_PROC_FS > void socket_seq_show(struct seq_file *seq) > { > - int cpu; > - int counter = 0; > - > - for_each_possible_cpu(cpu) > - counter += per_cpu(sockets_in_use, cpu); > - > - /* It can be negative, by the way. 8) */ > - if (counter < 0) > - counter = 0; > - > - seq_printf(seq, "sockets: used %d\n", counter); You've deleted the only use of "sockets_in_use" but you have not removed that per-cpu variable and it's maintainence. But do not even bother fixing this if you cannot explain properly why these changes are an improvement. I do not understant it, and until I do I cannot consider these changes seriously. Thank you.