Re: [PATCH v6 2/3] sock: Move the socket inuse to namespace.

2017-12-13 Thread Tonghao Zhang
On Wed, Dec 13, 2017 at 2:04 AM, Cong Wang wrote: > On Sun, Dec 10, 2017 at 7:12 AM, Tonghao Zhang > wrote: >> diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c >> index b797832..6c191fb 100644 >> --- a/net/core/net_namespace.c >> +++ b/net/core/net_namespace.c >> @@ -363,6 +363,1

Re: [PATCH v6 2/3] sock: Move the socket inuse to namespace.

2017-12-12 Thread Cong Wang
On Sun, Dec 10, 2017 at 7:12 AM, Tonghao Zhang wrote: > diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c > index b797832..6c191fb 100644 > --- a/net/core/net_namespace.c > +++ b/net/core/net_namespace.c > @@ -363,6 +363,13 @@ static struct net *net_alloc(void) > if (!net) >

[PATCH v6 2/3] sock: Move the socket inuse to namespace.

2017-12-10 Thread Tonghao Zhang
In some case, we want to know how many sockets are in use in different _net_ namespaces. It's a key resource metric. This patch adds a member in struct netns_core. This is a counter for socket-inuse in the _net_ namespace. The patch will add/sub counter in the sk_alloc, sk_clone_lock and __sk_free