netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make inet_twsk_put similar to sock_put
@ 2009-05-06  4:48 Arnaldo Carvalho de Melo
  2009-05-06 23:51 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-05-06  4:48 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Networking Development Mailing List

By separating the freeing code from the refcounting decrementing.
Probably reducing icache pressure when we still have reference counts to
go.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index 8554d0e..68a8d89 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -49,19 +49,22 @@ static void __inet_twsk_kill(struct inet_timewait_sock *tw,
 	inet_twsk_put(tw);
 }
 
-void inet_twsk_put(struct inet_timewait_sock *tw)
+static noinline void inet_twsk_free(struct inet_timewait_sock *tw)
 {
-	if (atomic_dec_and_test(&tw->tw_refcnt)) {
-		struct module *owner = tw->tw_prot->owner;
-		twsk_destructor((struct sock *)tw);
+	struct module *owner = tw->tw_prot->owner;
+	twsk_destructor((struct sock *)tw);
 #ifdef SOCK_REFCNT_DEBUG
-		printk(KERN_DEBUG "%s timewait_sock %p released\n",
-		       tw->tw_prot->name, tw);
+	pr_debug("%s timewait_sock %p released\n", tw->tw_prot->name, tw);
 #endif
-		release_net(twsk_net(tw));
-		kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw);
-		module_put(owner);
-	}
+	release_net(twsk_net(tw));
+	kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw);
+	module_put(owner);
+}
+
+void inet_twsk_put(struct inet_timewait_sock *tw)
+{
+	if (atomic_dec_and_test(&tw->tw_refcnt))
+		inet_twsk_free(tw);
 }
 EXPORT_SYMBOL_GPL(inet_twsk_put);
 

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

* Re: [PATCH] Make inet_twsk_put similar to sock_put
  2009-05-06  4:48 [PATCH] Make inet_twsk_put similar to sock_put Arnaldo Carvalho de Melo
@ 2009-05-06 23:51 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-05-06 23:51 UTC (permalink / raw)
  To: acme; +Cc: netdev

From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Wed, 6 May 2009 01:48:19 -0300

> By separating the freeing code from the refcounting decrementing.
> Probably reducing icache pressure when we still have reference counts to
> go.
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Applied to net-next-2.6, thanks!

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

end of thread, other threads:[~2009-05-06 23:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-06  4:48 [PATCH] Make inet_twsk_put similar to sock_put Arnaldo Carvalho de Melo
2009-05-06 23:51 ` 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).