Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90450
b: refs/heads/master
c: 60e7663
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Mar 28, 2008
1 parent 6563e5e commit a090946
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1338d466d9c3f8a65cc6d83c629cd906f2a989f8
refs/heads/master: 60e7663d462af3994f292cb3691ea4f7371a9220
18 changes: 0 additions & 18 deletions trunk/include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,31 +640,13 @@ static inline void sk_refcnt_debug_release(const struct sock *sk)
# define REF_PROTO_INUSE(NAME) PCOUNTER_MEMBER_INITIALIZER(NAME, .inuse)
/* Called with local bh disabled */
extern void sock_prot_inuse_add(struct proto *prot, int inc);

static inline int sock_prot_inuse_init(struct proto *proto)
{
return pcounter_alloc(&proto->inuse);
}

extern int sock_prot_inuse_get(struct proto *proto);

static inline void sock_prot_inuse_free(struct proto *proto)
{
pcounter_free(&proto->inuse);
}
#else
# define DEFINE_PROTO_INUSE(NAME)
# define REF_PROTO_INUSE(NAME)
static void inline sock_prot_inuse_add(struct proto *prot, int inc)
{
}
static int inline sock_prot_inuse_init(struct proto *proto)
{
return 0;
}
static void inline sock_prot_inuse_free(struct proto *proto)
{
}
#endif


Expand Down
11 changes: 1 addition & 10 deletions trunk/net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1999,19 +1999,14 @@ int proto_register(struct proto *prot, int alloc_slab)
char *request_sock_slab_name = NULL;
char *timewait_sock_slab_name;

if (sock_prot_inuse_init(prot) != 0) {
printk(KERN_CRIT "%s: Can't alloc inuse counters!\n", prot->name);
goto out;
}

if (alloc_slab) {
prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0,
SLAB_HWCACHE_ALIGN, NULL);

if (prot->slab == NULL) {
printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n",
prot->name);
goto out_free_inuse;
goto out;
}

if (prot->rsk_prot != NULL) {
Expand Down Expand Up @@ -2070,8 +2065,6 @@ int proto_register(struct proto *prot, int alloc_slab)
out_free_sock_slab:
kmem_cache_destroy(prot->slab);
prot->slab = NULL;
out_free_inuse:
sock_prot_inuse_free(prot);
out:
return -ENOBUFS;
}
Expand All @@ -2085,8 +2078,6 @@ void proto_unregister(struct proto *prot)
list_del(&prot->node);
write_unlock(&proto_list_lock);

sock_prot_inuse_free(prot);

if (prot->slab != NULL) {
kmem_cache_destroy(prot->slab);
prot->slab = NULL;
Expand Down

0 comments on commit a090946

Please sign in to comment.