[rds-devel] [PATCH 09/19] Add infrastructure for RDS global statistics per network namespace.
Jie Liu
jeff.liu at oracle.com
Sun Oct 7 05:14:08 PDT 2012
Signed-off-by: Jie Liu <jeff.liu at oracle.com>
---
include/net/netns/rds.h | 3 +++
net/rds/af_rds.c | 9 ++++++++-
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/include/net/netns/rds.h b/include/net/netns/rds.h
index 6712fe3..76afd59 100644
--- a/include/net/netns/rds.h
+++ b/include/net/netns/rds.h
@@ -19,6 +19,9 @@ struct netns_rds {
spinlock_t rds_cong_lock;
struct list_head rds_cong_monitor;
rwlock_t rds_cong_monitor_lock;
+
+ /* global statistics */
+ struct rds_statistics __percpu *rds_stats;
};
#endif
diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c
index cde87df..41e1d95 100644
--- a/net/rds/af_rds.c
+++ b/net/rds/af_rds.c
@@ -538,20 +538,27 @@ out:
*/
static int __net_init rds_pernet_init(struct net *net)
{
- int ret;
+ int ret = -ENOMEM;
INIT_LIST_HEAD(&net->rds.rds_sock_list);
spin_lock_init(&net->rds.rds_sock_lock);
net->rds.rds_sock_count = 0;
+ net->rds.rds_stats = alloc_percpu(struct rds_statistics);
+ if (!net->rds.rds_stats)
+ goto out;
+
ret = rds_cong_init(net);
+out:
return ret;
}
static void __net_exit rds_pernet_exit(struct net *net)
{
rds_cong_exit(net);
+ free_percpu(net->rds.rds_stats);
+ net->rds.rds_stats = NULL;
}
static struct pernet_operations __net_initdata rds_net_ops = {
--
1.7.4.1
More information about the rds-devel
mailing list