aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/sock.h18
-rw-r--r--net/core/sock.c11
2 files changed, 1 insertions, 28 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index ebf9552664b2..1f4294252dd7 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -640,31 +640,13 @@ static inline void sk_refcnt_debug_release(const struct sock *sk)
640# define REF_PROTO_INUSE(NAME) PCOUNTER_MEMBER_INITIALIZER(NAME, .inuse) 640# define REF_PROTO_INUSE(NAME) PCOUNTER_MEMBER_INITIALIZER(NAME, .inuse)
641/* Called with local bh disabled */ 641/* Called with local bh disabled */
642extern void sock_prot_inuse_add(struct proto *prot, int inc); 642extern void sock_prot_inuse_add(struct proto *prot, int inc);
643
644static inline int sock_prot_inuse_init(struct proto *proto)
645{
646 return pcounter_alloc(&proto->inuse);
647}
648
649extern int sock_prot_inuse_get(struct proto *proto); 643extern int sock_prot_inuse_get(struct proto *proto);
650
651static inline void sock_prot_inuse_free(struct proto *proto)
652{
653 pcounter_free(&proto->inuse);
654}
655#else 644#else
656# define DEFINE_PROTO_INUSE(NAME) 645# define DEFINE_PROTO_INUSE(NAME)
657# define REF_PROTO_INUSE(NAME) 646# define REF_PROTO_INUSE(NAME)
658static void inline sock_prot_inuse_add(struct proto *prot, int inc) 647static void inline sock_prot_inuse_add(struct proto *prot, int inc)
659{ 648{
660} 649}
661static int inline sock_prot_inuse_init(struct proto *proto)
662{
663 return 0;
664}
665static void inline sock_prot_inuse_free(struct proto *proto)
666{
667}
668#endif 650#endif
669 651
670 652
diff --git a/net/core/sock.c b/net/core/sock.c
index 174c64bc7a43..c1ae56eb96ec 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1999,11 +1999,6 @@ int proto_register(struct proto *prot, int alloc_slab)
1999 char *request_sock_slab_name = NULL; 1999 char *request_sock_slab_name = NULL;
2000 char *timewait_sock_slab_name; 2000 char *timewait_sock_slab_name;
2001 2001
2002 if (sock_prot_inuse_init(prot) != 0) {
2003 printk(KERN_CRIT "%s: Can't alloc inuse counters!\n", prot->name);
2004 goto out;
2005 }
2006
2007 if (alloc_slab) { 2002 if (alloc_slab) {
2008 prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, 2003 prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0,
2009 SLAB_HWCACHE_ALIGN, NULL); 2004 SLAB_HWCACHE_ALIGN, NULL);
@@ -2011,7 +2006,7 @@ int proto_register(struct proto *prot, int alloc_slab)
2011 if (prot->slab == NULL) { 2006 if (prot->slab == NULL) {
2012 printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", 2007 printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n",
2013 prot->name); 2008 prot->name);
2014 goto out_free_inuse; 2009 goto out;
2015 } 2010 }
2016 2011
2017 if (prot->rsk_prot != NULL) { 2012 if (prot->rsk_prot != NULL) {
@@ -2070,8 +2065,6 @@ out_free_request_sock_slab_name:
2070out_free_sock_slab: 2065out_free_sock_slab:
2071 kmem_cache_destroy(prot->slab); 2066 kmem_cache_destroy(prot->slab);
2072 prot->slab = NULL; 2067 prot->slab = NULL;
2073out_free_inuse:
2074 sock_prot_inuse_free(prot);
2075out: 2068out:
2076 return -ENOBUFS; 2069 return -ENOBUFS;
2077} 2070}
@@ -2085,8 +2078,6 @@ void proto_unregister(struct proto *prot)
2085 list_del(&prot->node); 2078 list_del(&prot->node);
2086 write_unlock(&proto_list_lock); 2079 write_unlock(&proto_list_lock);
2087 2080
2088 sock_prot_inuse_free(prot);
2089
2090 if (prot->slab != NULL) { 2081 if (prot->slab != NULL) {
2091 kmem_cache_destroy(prot->slab); 2082 kmem_cache_destroy(prot->slab);
2092 prot->slab = NULL; 2083 prot->slab = NULL;