Use existing sock refcnt debugging infrastructure
Subsystems (3)
PATCH 1/1 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.
---
net/packet/af_packet.c +3 -8
@@ -139,9 +139,6 @@ dev->hard_header == NULL (ll header is added by device, we cannot control it)static HLIST_HEAD (packet_sklist);static DEFINE_RWLOCK (packet_sklist_lock); -static atomic_t packet_socks_nr; - -/* Private packet socket structures. */ struct packet_mclist
@@ -236,10 +233,7 @@ static void packet_sock_destruct(struct sock *sk)return ; } -atomic_dec (&packet_socks_nr); -#ifdef PACKET_REFCNT_DEBUG -printk (KERN_DEBUG "PACKET socket %p is free, %d are alive\n" , sk,atomic_read (&packet_socks_nr)); -#endif +sk_refcnt_debug_dec (sk); }
@@ -849,6 +843,7 @@ static int packet_release(struct socket *sock)/* Purge queues */ skb_queue_purge (&sk->sk_receive_queue); +sk_refcnt_debug_release (sk);sock_put (sk);return 0 ;
@@ -1010,7 +1005,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol) po->num = proto; sk->sk_destruct = packet_sock_destruct; -atomic_inc (&packet_socks_nr); +sk_refcnt_debug_inc (sk);/* * Attach a protocol block
Signature · 1 line
1.5.3.4
Em Fri, Nov 09, 2007 at 04:39:41PM +0300, Pavel Emelyanov escreveu:
Quoted 7 lines
The
packet_socks_nrvariable 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 <[email protected]>
Quoted 52 lines
---
net/packet/af_packet.c +3
-8@@ -139,9 +139,6 @@ dev->hard_header == NULL (ll header is added by device, we cannot control it)static HLIST_HEAD (packet_sklist);static DEFINE_RWLOCK (packet_sklist_lock); -static atomic_t packet_socks_nr; - -/* Private packet socket structures. */ struct packet_mclist @@ -236,10 +233,7 @@ static void packet_sock_destruct(struct sock *sk)return ; } -atomic_dec (&packet_socks_nr); -#ifdef PACKET_REFCNT_DEBUG -printk (KERN_DEBUG "PACKET socket %p is free, %d are alive\n" , sk,atomic_read (&packet_socks_nr)); -#endif +sk_refcnt_debug_dec (sk); }@@ -849,6 +843,7 @@ static int packet_release(struct socket *sock)/* Purge queues */ skb_queue_purge (&sk->sk_receive_queue); +sk_refcnt_debug_release (sk);sock_put (sk);return 0 ;@@ -1010,7 +1005,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol) po->num = proto; sk->sk_destruct = packet_sock_destruct; -atomic_inc (&packet_socks_nr); +sk_refcnt_debug_inc (sk);/* * Attach a protocol block Signature · 6 lines
1.5.3.4 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
From: "Arnaldo Carvalho de Melo" <[email protected]>
Date: Fri, 9 Nov 2007 12:37:42 -0200
Quoted 10 lines
Em Fri, Nov 09, 2007 at 04:39:41PM +0300, Pavel Emelyanov escreveu:
Quoted 7 lines
The
packet_socks_nrvariable 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 <[email protected]>
Applied.