aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2014-05-14 05:39:08 -0400
committerDavid S. Miller <davem@davemloft.net>2014-05-14 15:19:47 -0400
commit6163a194e02ab6cab2758b277a0ae082378dd4e6 (patch)
treebdd00bd92223c32f826b912323c5e50b280f3850 /net/tipc
parent3fdddd859af235119bdfb09ccc886fe48b97fc72 (diff)
tipc: decrease connection flow control window
Memory overhead when allocating big buffers for data transfer may be quite significant. E.g., truesize of a 64 KB buffer turns out to be 132 KB, 2 x the requested size. This invalidates the "worst case" calculation we have been using to determine the default socket receive buffer limit, which is based on the assumption that 1024x64KB = 67MB buffers may be queued up on a socket. Since TIPC connections cannot survive hitting the buffer limit, we have to compensate for this overhead. We do that in this commit by dividing the fix connection flow control window from 1024 (2*512) messages to 512 (2*256). Since older version nodes send out acks at 512 message intervals, compatibility with such nodes is guaranteed, although performance may be non-optimal in such cases. Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/core.c7
-rw-r--r--net/tipc/port.h9
-rw-r--r--net/tipc/socket.c4
3 files changed, 11 insertions, 9 deletions
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 57f8ae9aa466..676d18015dd8 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -154,10 +154,11 @@ static int __init tipc_init(void)
154 tipc_max_ports = CONFIG_TIPC_PORTS; 154 tipc_max_ports = CONFIG_TIPC_PORTS;
155 tipc_net_id = 4711; 155 tipc_net_id = 4711;
156 156
157 sysctl_tipc_rmem[0] = CONN_OVERLOAD_LIMIT >> 4 << TIPC_LOW_IMPORTANCE; 157 sysctl_tipc_rmem[0] = TIPC_CONN_OVERLOAD_LIMIT >> 4 <<
158 sysctl_tipc_rmem[1] = CONN_OVERLOAD_LIMIT >> 4 << 158 TIPC_LOW_IMPORTANCE;
159 sysctl_tipc_rmem[1] = TIPC_CONN_OVERLOAD_LIMIT >> 4 <<
159 TIPC_CRITICAL_IMPORTANCE; 160 TIPC_CRITICAL_IMPORTANCE;
160 sysctl_tipc_rmem[2] = CONN_OVERLOAD_LIMIT; 161 sysctl_tipc_rmem[2] = TIPC_CONN_OVERLOAD_LIMIT;
161 162
162 res = tipc_core_start(); 163 res = tipc_core_start();
163 if (res) 164 if (res)
diff --git a/net/tipc/port.h b/net/tipc/port.h
index a00397393bd1..5dfd165df1d7 100644
--- a/net/tipc/port.h
+++ b/net/tipc/port.h
@@ -42,9 +42,10 @@
42#include "msg.h" 42#include "msg.h"
43#include "node_subscr.h" 43#include "node_subscr.h"
44 44
45#define TIPC_FLOW_CONTROL_WIN 512 45#define TIPC_CONNACK_INTV 256
46#define CONN_OVERLOAD_LIMIT ((TIPC_FLOW_CONTROL_WIN * 2 + 1) * \ 46#define TIPC_FLOWCTRL_WIN (TIPC_CONNACK_INTV * 2)
47 SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE)) 47#define TIPC_CONN_OVERLOAD_LIMIT ((TIPC_FLOWCTRL_WIN * 2 + 1) * \
48 SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE))
48 49
49/** 50/**
50 * struct tipc_port - TIPC port structure 51 * struct tipc_port - TIPC port structure
@@ -187,7 +188,7 @@ static inline void tipc_port_unlock(struct tipc_port *p_ptr)
187 188
188static inline int tipc_port_congested(struct tipc_port *p_ptr) 189static inline int tipc_port_congested(struct tipc_port *p_ptr)
189{ 190{
190 return (p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2); 191 return ((p_ptr->sent - p_ptr->acked) >= TIPC_FLOWCTRL_WIN);
191} 192}
192 193
193 194
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 3f9912f87d0d..8685daf060f9 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1101,7 +1101,7 @@ restart:
1101 /* Consume received message (optional) */ 1101 /* Consume received message (optional) */
1102 if (likely(!(flags & MSG_PEEK))) { 1102 if (likely(!(flags & MSG_PEEK))) {
1103 if ((sock->state != SS_READY) && 1103 if ((sock->state != SS_READY) &&
1104 (++port->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) 1104 (++port->conn_unacked >= TIPC_CONNACK_INTV))
1105 tipc_acknowledge(port->ref, port->conn_unacked); 1105 tipc_acknowledge(port->ref, port->conn_unacked);
1106 advance_rx_queue(sk); 1106 advance_rx_queue(sk);
1107 } 1107 }
@@ -1210,7 +1210,7 @@ restart:
1210 1210
1211 /* Consume received message (optional) */ 1211 /* Consume received message (optional) */
1212 if (likely(!(flags & MSG_PEEK))) { 1212 if (likely(!(flags & MSG_PEEK))) {
1213 if (unlikely(++port->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) 1213 if (unlikely(++port->conn_unacked >= TIPC_CONNACK_INTV))
1214 tipc_acknowledge(port->ref, port->conn_unacked); 1214 tipc_acknowledge(port->ref, port->conn_unacked);
1215 advance_rx_queue(sk); 1215 advance_rx_queue(sk);
1216 } 1216 }