aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-11-11 00:38:48 -0500
committerDavid S. Miller <davem@davemloft.net>2007-11-11 00:38:48 -0500
commit17ab56a260734aabf7f03cc97785dda81571ea24 (patch)
treed4d1ca98c62e0ae05156246c9cb2a7acf66e48e4
parente9671fcb3bef1fe2e71aa0456bd5b7eec9e8de4d (diff)
[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: Pavel Emelyanov <xemul@openvz.org> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/packet/af_packet.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 4cb2dfba0993..36331a5f0abe 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -139,9 +139,6 @@ dev->hard_header == NULL (ll header is added by device, we cannot control it)
139static HLIST_HEAD(packet_sklist); 139static HLIST_HEAD(packet_sklist);
140static DEFINE_RWLOCK(packet_sklist_lock); 140static DEFINE_RWLOCK(packet_sklist_lock);
141 141
142static atomic_t packet_socks_nr;
143
144
145/* Private packet socket structures. */ 142/* Private packet socket structures. */
146 143
147struct packet_mclist 144struct packet_mclist
@@ -236,10 +233,7 @@ static void packet_sock_destruct(struct sock *sk)
236 return; 233 return;
237 } 234 }
238 235
239 atomic_dec(&packet_socks_nr); 236 sk_refcnt_debug_dec(sk);
240#ifdef PACKET_REFCNT_DEBUG
241 printk(KERN_DEBUG "PACKET socket %p is free, %d are alive\n", sk, atomic_read(&packet_socks_nr));
242#endif
243} 237}
244 238
245 239
@@ -849,6 +843,7 @@ static int packet_release(struct socket *sock)
849 /* Purge queues */ 843 /* Purge queues */
850 844
851 skb_queue_purge(&sk->sk_receive_queue); 845 skb_queue_purge(&sk->sk_receive_queue);
846 sk_refcnt_debug_release(sk);
852 847
853 sock_put(sk); 848 sock_put(sk);
854 return 0; 849 return 0;
@@ -1010,7 +1005,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
1010 po->num = proto; 1005 po->num = proto;
1011 1006
1012 sk->sk_destruct = packet_sock_destruct; 1007 sk->sk_destruct = packet_sock_destruct;
1013 atomic_inc(&packet_socks_nr); 1008 sk_refcnt_debug_inc(sk);
1014 1009
1015 /* 1010 /*
1016 * Attach a protocol block 1011 * Attach a protocol block