Commit 17ab56a2 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

[PACKET]: Use existing sock refcnt debugging infrastructure

The packet_socks_nr variable is used purely for debugging
the number of sockets.

As Arnaldo pointed out, there's already an infrastructure
for this purposes, so switch to using it.
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Acked-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e9671fcb
...@@ -139,9 +139,6 @@ dev->hard_header == NULL (ll header is added by device, we cannot control it) ...@@ -139,9 +139,6 @@ dev->hard_header == NULL (ll header is added by device, we cannot control it)
static HLIST_HEAD(packet_sklist); static HLIST_HEAD(packet_sklist);
static DEFINE_RWLOCK(packet_sklist_lock); static DEFINE_RWLOCK(packet_sklist_lock);
static atomic_t packet_socks_nr;
/* Private packet socket structures. */ /* Private packet socket structures. */
struct packet_mclist struct packet_mclist
...@@ -236,10 +233,7 @@ static void packet_sock_destruct(struct sock *sk) ...@@ -236,10 +233,7 @@ static void packet_sock_destruct(struct sock *sk)
return; return;
} }
atomic_dec(&packet_socks_nr); sk_refcnt_debug_dec(sk);
#ifdef PACKET_REFCNT_DEBUG
printk(KERN_DEBUG "PACKET socket %p is free, %d are alive\n", sk, atomic_read(&packet_socks_nr));
#endif
} }
...@@ -849,6 +843,7 @@ static int packet_release(struct socket *sock) ...@@ -849,6 +843,7 @@ static int packet_release(struct socket *sock)
/* Purge queues */ /* Purge queues */
skb_queue_purge(&sk->sk_receive_queue); skb_queue_purge(&sk->sk_receive_queue);
sk_refcnt_debug_release(sk);
sock_put(sk); sock_put(sk);
return 0; return 0;
...@@ -1010,7 +1005,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol) ...@@ -1010,7 +1005,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
po->num = proto; po->num = proto;
sk->sk_destruct = packet_sock_destruct; sk->sk_destruct = packet_sock_destruct;
atomic_inc(&packet_socks_nr); sk_refcnt_debug_inc(sk);
/* /*
* Attach a protocol block * Attach a protocol block
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment