aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-05-06 19:50:52 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-06 19:50:52 -0400
commit4dbc8ef7e1123bb8a591d75a2b84413aa261a9f4 (patch)
tree2532c1cf032c4011c88b5cd68651b5558f70b231 /net/ipv4
parent9ce77666da48513058e330634a766d4752324f8e (diff)
net: Make inet_twsk_put similar to sock_put
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/inet_timewait_sock.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index 8554d0ea1719..68a8d892c711 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,
49 inet_twsk_put(tw); 49 inet_twsk_put(tw);
50} 50}
51 51
52void inet_twsk_put(struct inet_timewait_sock *tw) 52static noinline void inet_twsk_free(struct inet_timewait_sock *tw)
53{ 53{
54 if (atomic_dec_and_test(&tw->tw_refcnt)) { 54 struct module *owner = tw->tw_prot->owner;
55 struct module *owner = tw->tw_prot->owner; 55 twsk_destructor((struct sock *)tw);
56 twsk_destructor((struct sock *)tw);
57#ifdef SOCK_REFCNT_DEBUG 56#ifdef SOCK_REFCNT_DEBUG
58 printk(KERN_DEBUG "%s timewait_sock %p released\n", 57 pr_debug("%s timewait_sock %p released\n", tw->tw_prot->name, tw);
59 tw->tw_prot->name, tw);
60#endif 58#endif
61 release_net(twsk_net(tw)); 59 release_net(twsk_net(tw));
62 kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw); 60 kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw);
63 module_put(owner); 61 module_put(owner);
64 } 62}
63
64void inet_twsk_put(struct inet_timewait_sock *tw)
65{
66 if (atomic_dec_and_test(&tw->tw_refcnt))
67 inet_twsk_free(tw);
65} 68}
66EXPORT_SYMBOL_GPL(inet_twsk_put); 69EXPORT_SYMBOL_GPL(inet_twsk_put);
67 70