netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
	Cong Wang <xiyou.wangcong@gmail.com>
Subject: Re: [PATCH v4 2/2] sock: Move the socket inuse to namespace.
Date: Fri, 8 Dec 2017 00:56:15 +0800	[thread overview]
Message-ID: <CAMDZJNWzmfSLXScJbcPHZ0nk+aHAQueEjSgCHGCDnHwGMTfopQ@mail.gmail.com> (raw)
In-Reply-To: <20171125.235302.781017870270039369.davem@davemloft.net>

On Sat, Nov 25, 2017 at 10:53 PM, David Miller <davem@davemloft.net> wrote:
> 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.
Sorry, I am so later to reply. I send  the v5 and the comment may
explain the reason.

> 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.
So sorry :(

> 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.
Yes, I should check the patch carefully and add more detail. I may do it better.
The v5 patch may be useful. Thanks so much.

> Thank you.

      reply	other threads:[~2017-12-07 16:56 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
2017-12-07 16:56   ` Tonghao Zhang [this message]

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=CAMDZJNWzmfSLXScJbcPHZ0nk+aHAQueEjSgCHGCDnHwGMTfopQ@mail.gmail.com \
    --to=xiangxia.m.yue@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --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).