From: Eldad Zinger Date: Sun, 24 Oct 2010 15:15:06 +0000 (+0200) Subject: sdp: fix socket_allocated counter X-Git-Tag: v4.1.12-92~264^2~5^2~70 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e8d38e96dce207fecb49b68f79c9b03255ab7d33;p=users%2Fjedix%2Flinux-maple.git sdp: fix socket_allocated counter Signed-off-by: Eldad Zinger --- diff --git a/drivers/infiniband/ulp/sdp/sdp_main.c b/drivers/infiniband/ulp/sdp/sdp_main.c index 946becd4d283..62a5a46c6807 100644 --- a/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/drivers/infiniband/ulp/sdp/sdp_main.c @@ -537,6 +537,7 @@ static void sdp_destruct(struct sock *sk) sdp_add_to_history(sk, __func__); percpu_counter_dec(sk->sk_prot->orphan_count); + percpu_counter_dec(sk->sk_prot->sockets_allocated); ssk->destructed_already = 1; down_read(&device_removal_lock); @@ -2773,6 +2774,7 @@ static int sdp_create_socket(struct net *net, struct socket *sock, int protocol) } sock_init_data(sock, sk); sk->sk_protocol = 0x0 /* TODO: inherit tcp socket to use IPPROTO_TCP */; + percpu_counter_inc(sk->sk_prot->sockets_allocated); memset((struct inet_sock *)sk + 1, 0, sizeof(struct sdp_sock) - sizeof(struct inet_sock)); @@ -3015,6 +3017,10 @@ static void __exit sdp_exit(void) printk(KERN_WARNING "%s: current mem usage %d\n", __func__, atomic_read(&sdp_current_mem_usage)); + if (percpu_counter_sum(sockets_allocated)) + printk(KERN_WARNING "%s: sockets_allocated %lld\n", __func__, + percpu_counter_sum(sockets_allocated)); + sdp_proc_unregister(); ib_unregister_client(&sdp_client);