[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1512667208.25033.13.camel@gmail.com>
Date: Thu, 07 Dec 2017 09:20:08 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Tonghao Zhang <xiangxia.m.yue@...il.com>, davem@...emloft.net,
xiyou.wangcong@...il.com, edumazet@...gle.com, willemb@...gle.com
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH v5 2/2] sock: Move the socket inuse to namespace.
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 ?
Powered by blists - more mailing lists