Skip to content

Commit e17549f

Browse files
Hakon-BuggeSomasundaram Krishnasamy
authored andcommitted
rds: Change heartbeat params from module params to sysctl
Orabug: 30418039 Signed-off-by: Håkon Bugge <[email protected]> Reviewed-by: Ka-Cheong Poon <[email protected]> Tested-by: Michael Nowak <[email protected]> --- Since Exadata is not (yet) using the heartbeat mechanism, now is a good time to change the params to sysctl. v1->v2: * Added commentary to the sysctl parameters, as suggested by Ka-Cheong * s/proc_dointvec_minmax/proc_douintvec_minmax/ as detected by Ka-Cheong * Added Ka-Cheong's r-b and Mike's t-b * Changed the default heartbeat interval to 60 seconds, as per discussions with Exadata (Mike Nowak) * Enabled heart-beating by default, as suggested by Mike Nowak Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent 2348372 commit e17549f

File tree

3 files changed

+41
-12
lines changed

3 files changed

+41
-12
lines changed

net/rds/rds.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,8 @@ extern unsigned int rds_sysctl_trace_level;
13171317
extern unsigned int rds_sysctl_shutdown_trace_start_time;
13181318
extern unsigned int rds_sysctl_shutdown_trace_end_time;
13191319
extern unsigned int rds_sysctl_passive_connect_delay_percent;
1320+
extern unsigned int rds_sysctl_conn_hb_timeout;
1321+
extern unsigned int rds_sysctl_conn_hb_interval;
13201322

13211323
/* threads.c */
13221324
int rds_threads_init(void);

net/rds/sysctl.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,23 @@ unsigned int rds_sysctl_passive_connect_delay_min_percent = 1;
6060
unsigned int rds_sysctl_passive_connect_delay_max_percent = 1000;
6161
unsigned int rds_sysctl_passive_connect_delay_percent = 100;
6262

63+
/* Heartbeat timeout in seconds. That is the time from a heartbeat ping
64+
* is sent, before the heartbeat mechanism drops the connection, unless
65+
* a heartbeat pong has been received.
66+
*/
67+
unsigned int rds_sysctl_min_conn_hb_timeout;
68+
unsigned int rds_sysctl_max_conn_hb_timeout = 60;
69+
unsigned int rds_sysctl_conn_hb_timeout = 10;
70+
71+
/* Heartbeat interval in seconds. The time from a successful heartbeat
72+
* pong has been received until a new heartbeat ping is sent out is
73+
* pseudo randomly chosen in the interval 50% to 150% of
74+
* rds_sysctl_min_conn_hb_interval.
75+
*/
76+
unsigned int rds_sysctl_min_conn_hb_interval = 10;
77+
unsigned int rds_sysctl_max_conn_hb_interval = 600;
78+
unsigned int rds_sysctl_conn_hb_interval = 60;
79+
6380
/*
6481
* We have official values, but must maintain the sysctl interface for existing
6582
* software that expects to find these values here.
@@ -153,6 +170,24 @@ static struct ctl_table rds_sysctl_rds_table[] = {
153170
.extra1 = &rds_sysctl_passive_connect_delay_min_percent,
154171
.extra2 = &rds_sysctl_passive_connect_delay_max_percent,
155172
},
173+
{
174+
.procname = "conn_heartbeat_timeout_secs",
175+
.data = &rds_sysctl_conn_hb_timeout,
176+
.maxlen = sizeof(rds_sysctl_conn_hb_timeout),
177+
.mode = 0644,
178+
.proc_handler = proc_douintvec_minmax,
179+
.extra1 = &rds_sysctl_min_conn_hb_timeout,
180+
.extra2 = &rds_sysctl_max_conn_hb_timeout,
181+
},
182+
{
183+
.procname = "conn_heartbeat_interval_secs",
184+
.data = &rds_sysctl_conn_hb_interval,
185+
.maxlen = sizeof(rds_sysctl_conn_hb_interval),
186+
.mode = 0644,
187+
.proc_handler = proc_douintvec_minmax,
188+
.extra1 = &rds_sysctl_min_conn_hb_interval,
189+
.extra2 = &rds_sysctl_max_conn_hb_interval,
190+
},
156191
{ }
157192
};
158193

net/rds/threads.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@
3636

3737
#include "rds.h"
3838

39-
static unsigned int rds_conn_hb_timeout = 0;
40-
module_param(rds_conn_hb_timeout, int, 0444);
41-
MODULE_PARM_DESC(rds_conn_hb_timeout, " Connection heartbeat timeout (seconds)");
42-
static unsigned int rds_conn_hb_interval = 10;
43-
module_param(rds_conn_hb_interval, int, 0444);
44-
MODULE_PARM_DESC(rds_conn_hb_interval, " Connection heartbeat interval (seconds)");
45-
46-
4739
/*
4840
* All of connection management is simplified by serializing it through
4941
* work queues that execute in a connection managing thread.
@@ -344,7 +336,7 @@ void rds_hb_worker(struct work_struct *work)
344336
int ret;
345337
struct rds_connection *conn = cp->cp_conn;
346338

347-
if (!rds_conn_hb_timeout || conn->c_loopback ||
339+
if (!rds_sysctl_conn_hb_timeout || conn->c_loopback ||
348340
conn->c_trans->t_type == RDS_TRANS_TCP)
349341
return;
350342

@@ -354,9 +346,9 @@ void rds_hb_worker(struct work_struct *work)
354346
if (!cp->cp_hb_start) {
355347
cp->cp_hb_state = HB_PONG_RCVD;
356348
/* Pseudo random from 50% to 150% of interval */
357-
delay = msecs_to_jiffies(rds_conn_hb_interval * 1000 / 2) +
358-
msecs_to_jiffies(prandom_u32() % rds_conn_hb_interval * 1000);
359-
} else if (now - cp->cp_hb_start > rds_conn_hb_timeout) {
349+
delay = msecs_to_jiffies(rds_sysctl_conn_hb_interval * 1000 / 2) +
350+
msecs_to_jiffies(prandom_u32() % rds_sysctl_conn_hb_interval * 1000);
351+
} else if (now - cp->cp_hb_start > rds_sysctl_conn_hb_timeout) {
360352
rds_rtd_ptr(RDS_RTD_CM,
361353
"RDS/IB: connection <%pI6c,%pI6c,%d> timed out (0x%lx,0x%lx)..discon and recon\n",
362354
&conn->c_laddr, &conn->c_faddr,

0 commit comments

Comments
 (0)