* [PATCH][PACKET] Use existing sock refcnt debugging infrastructure
@ 2007-11-09 13:39 Pavel Emelyanov
2007-11-09 14:37 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Emelyanov @ 2007-11-09 13:39 UTC (permalink / raw)
To: David Miller; +Cc: Arnaldo Carvalho de Melo, Linux Netdev List, devel
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>
---
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 4cb2dfb..36331a5 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)
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
--
1.5.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][PACKET] Use existing sock refcnt debugging infrastructure
2007-11-09 13:39 [PATCH][PACKET] Use existing sock refcnt debugging infrastructure Pavel Emelyanov
@ 2007-11-09 14:37 ` Arnaldo Carvalho de Melo
2007-11-11 5:38 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2007-11-09 14:37 UTC (permalink / raw)
To: Pavel Emelyanov
Cc: David Miller, Arnaldo Carvalho de Melo, Linux Netdev List, devel
Em Fri, Nov 09, 2007 at 04:39:41PM +0300, Pavel Emelyanov escreveu:
> 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>
> ---
>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 4cb2dfb..36331a5 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)
> 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
> --
> 1.5.3.4
>
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][PACKET] Use existing sock refcnt debugging infrastructure
2007-11-09 14:37 ` Arnaldo Carvalho de Melo
@ 2007-11-11 5:38 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2007-11-11 5:38 UTC (permalink / raw)
To: acme; +Cc: xemul, netdev, devel
From: "Arnaldo Carvalho de Melo" <acme@redhat.com>
Date: Fri, 9 Nov 2007 12:37:42 -0200
> Em Fri, Nov 09, 2007 at 04:39:41PM +0300, Pavel Emelyanov escreveu:
> > 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>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-11-11 5:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-09 13:39 [PATCH][PACKET] Use existing sock refcnt debugging infrastructure Pavel Emelyanov
2007-11-09 14:37 ` Arnaldo Carvalho de Melo
2007-11-11 5:38 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).