[rds-devel] [PATCH 14/19] Add infrastructure for TCP statistics per network namespace.
Jie Liu
jeff.liu at oracle.com
Sun Oct 7 05:18:06 PDT 2012
- Introduce percpu tcp stats to netns_rds.
- init/free tcp stats per netns.
Signed-off-by: Jie Liu <jeff.liu at oracle.com>
---
include/net/netns/rds.h | 3 +++
net/rds/tcp.c | 7 +++++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/include/net/netns/rds.h b/include/net/netns/rds.h
index 78918fa..2662b87 100644
--- a/include/net/netns/rds.h
+++ b/include/net/netns/rds.h
@@ -36,10 +36,13 @@ struct netns_rds {
/* track rds_tcp_connection structs so they can be cleaned up */
struct list_head rds_tcp_conn_list;
spinlock_t rds_tcp_conn_lock;
+
/* exporting info */
struct list_head rds_tcp_tc_list;
spinlock_t rds_tcp_tc_list_lock;
unsigned int rds_tcp_tc_count;
+
+ struct rds_tcp_statistics __percpu *rds_tcp_stats;
#endif
/* global statistics */
diff --git a/net/rds/tcp.c b/net/rds/tcp.c
index 7a49899..5c543b7 100644
--- a/net/rds/tcp.c
+++ b/net/rds/tcp.c
@@ -257,12 +257,18 @@ static int __net_init rds_tcp_pernet_init(struct net *net)
INIT_LIST_HEAD(&net->rds.rds_tcp_conn_list);
spin_lock_init(&net->rds.rds_tcp_conn_lock);
+ net->rds.rds_tcp_stats = alloc_percpu(struct rds_tcp_statistics);
+ if (!net->rds.rds_tcp_stats)
+ return -ENOMEM;
+
return 0;
}
static void __net_exit rds_tcp_pernet_exit(struct net *net)
{
rds_tcp_destroy_conns(net);
+ free_percpu(net->rds.rds_tcp_stats);
+ net->rds.rds_tcp_stats = NULL;
}
static struct pernet_operations __net_initdata rds_tcp_net_ops = {
@@ -284,6 +290,7 @@ static void rds_tcp_exit(void)
{
rds_info_deregister_func(RDS_INFO_TCP_SOCKETS, rds_tcp_tc_info);
rds_tcp_listen_stop();
+ rds_tcp_net_exit();
rds_trans_unregister(&rds_tcp_transport);
rds_tcp_recv_exit();
kmem_cache_destroy(rds_tcp_conn_slab);
--
1.7.4.1
More information about the rds-devel
mailing list