Skip to content

Commit 1fb85bc

Browse files
Greg Jumpervijay-suman
authored andcommitted
Revert "net/rds: Track "rds_tcp" module statistics per network namespace"
This reverts commit 4f9a0378bf6367ee54f124c629f003ebb4392f35. Orabug: 35811116 Signed-off-by: Greg Jumper <[email protected]> Reviewed-by: Sharath Srinivasan <[email protected]>
1 parent e1f4e4b commit 1fb85bc

File tree

8 files changed

+19
-89
lines changed

8 files changed

+19
-89
lines changed

include/uapi/linux/rds.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,6 @@ struct rds_rdma_send_notify {
501501
enum {
502502
RDS_MOD_UNSPEC,
503503
RDS_MOD_RDS, /* rds module */
504-
RDS_MOD_TCP, /* rds_tcp module */
505504

506505
/* Add new module before this. */
507506
RDS_MOD_MAX,

net/rds/rds.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,10 +1527,6 @@ DECLARE_PER_CPU_SHARED_ALIGNED(struct rds_statistics, rds_stats);
15271527
rds_stats_add_which(stats, member, count)
15281528
int rds_stats_net_init(struct net *net);
15291529
void rds_stats_net_exit(struct net *net);
1530-
int rds_mod_stats_register(struct net *net, int module,
1531-
struct rds_stats_struct *stats);
1532-
struct rds_stats_struct *rds_mod_stats_unregister(struct net *net,
1533-
int module);
15341530
void rds_stats_info_copy(struct rds_info_iterator *iter,
15351531
uint64_t *values, char **names, size_t nr);
15361532
void rds_stats_print(const char *where);

net/rds/tcp.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,6 @@ static int rds_tcp_conn_alloc(struct rds_connection *conn, gfp_t gfp)
386386
tc->t_tinc_data_rem = 0;
387387
INIT_WORK(&tc->t_fan_out_w, rds_tcp_fan_out_w);
388388
init_waitqueue_head(&tc->t_recv_done_waitq);
389-
tc->t_stats = __rds_get_mod_stats(conn->c_rns, RDS_MOD_TCP);
390389

391390
/* Once set, they will never change until the conn is dead. */
392391
conn->c_path[i].cp_transport_data = tc;
@@ -413,7 +412,6 @@ static void rds_tcp_conn_free(void *arg)
413412
list_del(&tc->t_tcp_node);
414413
spin_unlock_irqrestore(&rds_tcp_conn_lock, flags);
415414

416-
tc->t_stats = NULL;
417415
kmem_cache_free(rds_tcp_conn_slab, tc);
418416
}
419417

@@ -513,23 +511,17 @@ void rds_tcp_accept_work(struct rds_tcp_net *rtn)
513511
static __net_init int rds_tcp_init_net(struct net *net)
514512
{
515513
struct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid);
516-
struct ctl_table *tbl = NULL;
514+
struct ctl_table *tbl;
517515
int err = 0;
518516

519517
memset(rtn, 0, sizeof(*rtn));
520518

521519
mutex_init(&rtn->rds_tcp_accept_lock);
522520

523-
err = rds_tcp_stats_net_init(net);
524-
if (err)
525-
return err;
526-
527521
rtn->rds_tcp_accept_wq =
528522
create_singlethread_workqueue("rds_tcp_accept");
529-
if (!rtn->rds_tcp_accept_wq) {
530-
err = -ENOMEM;
531-
goto fail;
532-
}
523+
if (!rtn->rds_tcp_accept_wq)
524+
return -ENOMEM;
533525

534526
/* {snd, rcv}buf_size default to 0, which implies we let the
535527
* stack pick the value, and permit auto-tuning of buffer size.
@@ -541,8 +533,7 @@ static __net_init int rds_tcp_init_net(struct net *net)
541533
sizeof(rds_tcp_sysctl_table), GFP_KERNEL);
542534
if (!tbl) {
543535
pr_warn("could not set allocate syctl table\n");
544-
err = -ENOMEM;
545-
goto fail;
536+
return -ENOMEM;
546537
}
547538
rtn->ctl_table = tbl;
548539
}
@@ -579,7 +570,6 @@ static __net_init int rds_tcp_init_net(struct net *net)
579570
return 0;
580571

581572
fail:
582-
rds_tcp_stats_net_exit(net);
583573
if (net != &init_net)
584574
kfree(tbl);
585575
return err;
@@ -635,7 +625,6 @@ static void __net_exit rds_tcp_exit_net(struct net *net)
635625
struct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid);
636626

637627
rds_tcp_kill_sock(net, rtn);
638-
rds_tcp_stats_net_exit(net);
639628

640629
if (rtn->rds_tcp_sysctl)
641630
unregister_net_sysctl_table(rtn->rds_tcp_sysctl);

net/rds/tcp.h

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ struct rds_tcp_incoming {
2525
struct sk_buff_head ti_skb_list;
2626
};
2727

28-
struct rds_tcp_statistics {
29-
u64 s_tcp_data_ready_calls;
30-
u64 s_tcp_write_space_calls;
31-
u64 s_tcp_sndbuf_full;
32-
u64 s_tcp_connect_raced;
33-
u64 s_tcp_listen_closed_stale;
34-
u64 s_tcp_ka_timeout;
35-
};
36-
3728
struct rds_tcp_connection {
3829

3930
struct list_head t_tcp_node;
@@ -63,8 +54,15 @@ struct rds_tcp_connection {
6354

6455
/* for rds_tcp_conn_path_shutdown */
6556
wait_queue_head_t t_recv_done_waitq;
57+
};
6658

67-
struct rds_tcp_statistics __percpu *t_stats;
59+
struct rds_tcp_statistics {
60+
uint64_t s_tcp_data_ready_calls;
61+
uint64_t s_tcp_write_space_calls;
62+
uint64_t s_tcp_sndbuf_full;
63+
uint64_t s_tcp_connect_raced;
64+
uint64_t s_tcp_listen_closed_stale;
65+
uint64_t s_tcp_ka_timeout;
6866
};
6967

7068
/* tcp.c */
@@ -117,11 +115,8 @@ void rds_tcp_write_space(struct sock *sk);
117115

118116
/* tcp_stats.c */
119117
DECLARE_PER_CPU(struct rds_tcp_statistics, rds_tcp_stats);
120-
#define rds_tcp_stats_inc(stats, member) rds_stats_inc_which(stats, member)
118+
#define rds_tcp_stats_inc(member) rds_stats_inc_which(&rds_tcp_stats, member)
121119
unsigned int rds_tcp_stats_info_copy(struct rds_info_iterator *iter,
122120
unsigned int avail);
123-
int rds_tcp_stats_net_init(struct net *net);
124-
void rds_tcp_stats_net_exit(struct net *net);
125-
126121

127122
#endif

net/rds/tcp_connect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void rds_tcp_state_change(struct sock *sk)
8888
wake_up(&tc->t_recv_done_waitq);
8989
if (sk->sk_err == ETIMEDOUT &&
9090
icsk->icsk_probes_out >= keepalive_probes(tsock)) {
91-
rds_tcp_stats_inc(tc->t_stats, s_tcp_ka_timeout);
91+
rds_tcp_stats_inc(s_tcp_ka_timeout);
9292
rds_conn_path_drop(cp,
9393
DR_TCP_STATE_CLOSE_KA_TIMEOUT, 0);
9494
} else {
@@ -179,7 +179,7 @@ int rds_tcp_conn_path_connect(struct rds_conn_path *cp)
179179
tc->t_client_port_group = 0;
180180
port = port_low +
181181
tc->t_client_port_group * RDS_MPATH_WORKERS +
182-
cp->cp_index;
182+
cp->cp_index;
183183

184184
if (isv6)
185185
sin6.sin6_port = htons(port);

net/rds/tcp_recv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ void rds_tcp_data_ready(struct sock *sk)
467467

468468
tc = cp->cp_transport_data;
469469
ready = tc->t_orig_data_ready;
470-
rds_tcp_stats_inc(tc->t_stats, s_tcp_data_ready_calls);
470+
rds_tcp_stats_inc(s_tcp_data_ready_calls);
471471

472472
if (rds_tcp_read_sock(cp, GFP_ATOMIC) == -ENOMEM)
473473
rds_cond_queue_recv_work(cp, 0);

net/rds/tcp_send.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
152152
reason);
153153
/* write_space will hit after EAGAIN, all else fatal */
154154
if (ret == -EAGAIN) {
155-
rds_tcp_stats_inc(tc->t_stats, s_tcp_sndbuf_full);
155+
rds_tcp_stats_inc(s_tcp_sndbuf_full);
156156
ret = 0;
157157
} else {
158158
/* No need to disconnect/reconnect if path_drop
@@ -203,7 +203,7 @@ void rds_tcp_write_space(struct sock *sk)
203203
tc = cp->cp_transport_data;
204204
rdsdebug("write_space for tc %p\n", tc);
205205
write_space = tc->t_orig_write_space;
206-
rds_tcp_stats_inc(tc->t_stats, s_tcp_write_space_calls);
206+
rds_tcp_stats_inc(s_tcp_write_space_calls);
207207

208208
rdsdebug("tcp una %u\n", rds_tcp_snd_una(tc));
209209
tc->t_last_seen_una = rds_tcp_snd_una(tc);

net/rds/tcp_stats.c

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ unsigned int rds_tcp_stats_info_copy(struct rds_info_iterator *iter,
5353
unsigned int avail)
5454
{
5555
struct rds_tcp_statistics stats = {0, };
56-
struct rds_tcp_statistics *per_cpu_ns_ptr;
57-
struct rds_net *rns;
5856
uint64_t *src;
5957
uint64_t *sum;
6058
size_t i;
@@ -63,11 +61,8 @@ unsigned int rds_tcp_stats_info_copy(struct rds_info_iterator *iter,
6361
if (avail < ARRAY_SIZE(rds_tcp_stat_names))
6462
goto out;
6563

66-
rns = rds_ns(iter->net);
67-
per_cpu_ns_ptr = __rds_get_mod_stats(rns, RDS_MOD_TCP);
68-
6964
for_each_online_cpu(cpu) {
70-
src = (uint64_t *)per_cpu_ptr(per_cpu_ns_ptr, cpu);
65+
src = (uint64_t *)&(per_cpu(rds_tcp_stats, cpu));
7166
sum = (uint64_t *)&stats;
7267
for (i = 0; i < sizeof(stats) / sizeof(uint64_t); i++)
7368
*(sum++) += *(src++);
@@ -78,47 +73,3 @@ unsigned int rds_tcp_stats_info_copy(struct rds_info_iterator *iter,
7873
out:
7974
return ARRAY_SIZE(rds_tcp_stat_names);
8075
}
81-
82-
void rds_tcp_stats_net_exit(struct net *net)
83-
{
84-
struct rds_stats_struct *stats;
85-
86-
stats = rds_mod_stats_unregister(net, RDS_MOD_TCP);
87-
if (!net_eq(net, &init_net))
88-
free_percpu(stats->rs_stats);
89-
kfree(stats);
90-
}
91-
92-
int rds_tcp_stats_net_init(struct net *net)
93-
{
94-
struct rds_stats_struct *stats;
95-
int ret = 0;
96-
97-
stats = kmalloc(sizeof(*stats), GFP_KERNEL);
98-
if (!stats)
99-
return -ENOMEM;
100-
101-
stats->rs_names = rds_tcp_stat_names;
102-
stats->rs_num_stats = sizeof(struct rds_tcp_statistics) /
103-
sizeof(uint64_t);
104-
105-
if (net_eq(net, &init_net)) {
106-
stats->rs_stats = &rds_tcp_stats;
107-
ret = rds_mod_stats_register(net, RDS_MOD_TCP, stats);
108-
} else {
109-
stats->rs_stats =
110-
__alloc_percpu(sizeof(struct rds_tcp_statistics),
111-
cache_line_size());
112-
if (stats->rs_stats) {
113-
ret = rds_mod_stats_register(net, RDS_MOD_TCP, stats);
114-
if (ret)
115-
free_percpu(stats->rs_stats);
116-
} else {
117-
ret = -ENOMEM;
118-
}
119-
}
120-
121-
if (ret)
122-
kfree(stats);
123-
return ret;
124-
}

0 commit comments

Comments
 (0)