netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drop_monitor: convert some kfree_skb call sites to consume_skb
@ 2010-07-20 16:45 Neil Horman
  2010-07-20 20:28 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Neil Horman @ 2010-07-20 16:45 UTC (permalink / raw)
  To: netdev; +Cc: davem, viro, eparis, nhorman

Convert a few calls from kfree_skb to consume_skb

Noticed while I was working on dropwatch that I was detecting lots of internal
skb drops in several places.  While some are legitimate, several were not,
freeing skbs that were at the end of their life, rather than being discarded due
to an error.  This patch converts those calls sites from using kfree_skb to
consume_skb, which quiets the in-kernel drop_monitor code from detecting them as
drops.  Tested successfully by myself

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Eric Paris <eparis@redhat.com>
CC: Al Viro <viro@zeniv.linux.org.uk>


 kernel/audit.c           |    2 +-
 net/netlink/af_netlink.c |    9 +++++----
 net/unix/af_unix.c       |    2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index c71bd26..8296aa5 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -407,7 +407,7 @@ static void kauditd_send_skb(struct sk_buff *skb)
 		audit_hold_skb(skb);
 	} else
 		/* drop the extra reference if sent ok */
-		kfree_skb(skb);
+		consume_skb(skb);
 }
 
 static int kauditd_thread(void *dummy)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 7aeaa83..8648a99 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1076,14 +1076,15 @@ int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, u32 pid,
 	sk_for_each_bound(sk, node, &nl_table[ssk->sk_protocol].mc_list)
 		do_one_broadcast(sk, &info);
 
-	kfree_skb(skb);
+	consume_skb(skb);
 
 	netlink_unlock_table();
 
-	kfree_skb(info.skb2);
-
-	if (info.delivery_failure)
+	if (info.delivery_failure) {
+		kfree_skb(info.skb2);
 		return -ENOBUFS;
+	} else
+		consume_skb(info.skb2);
 
 	if (info.delivered) {
 		if (info.congested && (allocation & __GFP_WAIT))
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 75ba48b..4414a18 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1906,7 +1906,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
 				break;
 			}
 
-			kfree_skb(skb);
+			consume_skb(skb);
 
 			if (siocb->scm->fp)
 				break;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drop_monitor: convert some kfree_skb call sites to consume_skb
  2010-07-20 16:45 [PATCH] drop_monitor: convert some kfree_skb call sites to consume_skb Neil Horman
@ 2010-07-20 20:28 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-07-20 20:28 UTC (permalink / raw)
  To: nhorman; +Cc: netdev, viro, eparis

From: Neil Horman <nhorman@tuxdriver.com>
Date: Tue, 20 Jul 2010 12:45:56 -0400

> Convert a few calls from kfree_skb to consume_skb
> 
> Noticed while I was working on dropwatch that I was detecting lots of internal
> skb drops in several places.  While some are legitimate, several were not,
> freeing skbs that were at the end of their life, rather than being discarded due
> to an error.  This patch converts those calls sites from using kfree_skb to
> consume_skb, which quiets the in-kernel drop_monitor code from detecting them as
> drops.  Tested successfully by myself
> 
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-20 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-20 16:45 [PATCH] drop_monitor: convert some kfree_skb call sites to consume_skb Neil Horman
2010-07-20 20:28 ` 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).