netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: xiangxia.m.yue@gmail.com
Cc: netdev@vger.kernel.org, xiyou.wangcong@gmail.com
Subject: Re: [PATCH v4 2/2] sock: Move the socket inuse to namespace.
Date: Sat, 25 Nov 2017 23:53:02 +0900 (KST)	[thread overview]
Message-ID: <20171125.235302.781017870270039369.davem@davemloft.net> (raw)
In-Reply-To: <1511401885-3686-1-git-send-email-xiangxia.m.yue@gmail.com>

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
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 <zhangjunweimartin@didichuxing.com>
> Signed-off-by: Tonghao Zhang <zhangtonghao@didichuxing.com>

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.

  reply	other threads:[~2017-11-25 14:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23  1:51 [PATCH v4 2/2] sock: Move the socket inuse to namespace Tonghao Zhang
2017-11-25 14:53 ` David Miller [this message]
2017-12-07 16:56   ` Tonghao Zhang

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=20171125.235302.781017870270039369.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=xiangxia.m.yue@gmail.com \
    --cc=xiyou.wangcong@gmail.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).