All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Tonghao Zhang <xiangxia.m.yue@gmail.com>,
	davem@davemloft.net, xiyou.wangcong@gmail.com,
	edumazet@google.com, willemb@google.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v5 2/2] sock: Move the socket inuse to namespace.
Date: Thu, 07 Dec 2017 09:20:08 -0800	[thread overview]
Message-ID: <1512667208.25033.13.camel@gmail.com> (raw)
In-Reply-To: <1512665148-2413-2-git-send-email-xiangxia.m.yue@gmail.com>

On Thu, 2017-12-07 at 08:45 -0800, Tonghao Zhang wrote:
> In some case, we want to know how many sockets are in use in
> different _net_ namespaces. It's a key resource metric.
> 

...

> +static void sock_inuse_add(struct net *net, int val)
> +{
> +	if (net->core.prot_inuse)
> +		this_cpu_add(*net->core.sock_inuse, val);
> +}

This is very confusing.

Why testing net->core.prot_inuse for NULL is needed at all ?

Why not testing net->core.sock_inuse instead ?

  reply	other threads:[~2017-12-07 17:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 16:45 [PATCH v5 1/2] sock: Change the netns_core member name Tonghao Zhang
2017-12-07 16:45 ` [PATCH v5 2/2] sock: Move the socket inuse to namespace Tonghao Zhang
2017-12-07 17:20   ` Eric Dumazet [this message]
2017-12-07 21:28     ` Cong Wang
2017-12-08  5:28     ` Tonghao Zhang
2017-12-08  5:40       ` Eric Dumazet
2017-12-08  9:52         ` Tonghao Zhang
2017-12-08 11:29           ` Tonghao Zhang
2017-12-08 13:24             ` Eric Dumazet
2017-12-09  5:25               ` Tonghao Zhang
2017-12-08 22:09       ` Cong Wang
2017-12-09  5:27         ` Tonghao Zhang
2017-12-09 19:42           ` Cong Wang

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=1512667208.25033.13.camel@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.