From patchwork Wed May 14 09:39:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Maloy X-Patchwork-Id: 348675 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id AFBF9140094 for ; Wed, 14 May 2014 19:46:39 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752121AbaENJqf (ORCPT ); Wed, 14 May 2014 05:46:35 -0400 Received: from smtp103.biz.mail.gq1.yahoo.com ([98.137.12.178]:41074 "HELO smtp103.biz.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754175AbaENJqb (ORCPT ); Wed, 14 May 2014 05:46:31 -0400 Received: (qmail 6047 invoked from network); 14 May 2014 09:39:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1400060390; bh=yO631wGxmWTeEwTz1avY7WLzWn8IMGz6XU5gGTj+3/I=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=C+frtS0Qz/fMtrLe9EX2xLCmalIxO5vIV4MWgECmgk7/drO+AdiZ9Gg+5xaL4+VFhT+Ck8BrUK0Wui3DhLFSj/4LHqCN6f+5TEsiFHkd/hzADLrJey0SbCV+GvIakktP0VPTRi54xMDHLwdmTQ69eSw7FkUzwC0Vad1of/SzKeY= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: sKjpl5wVM1lW4OQ8yLQyzwyNRBN0KqPIYPI8dXA988dDf7z Q19Rx1K9qMqRrBRTp5r5eHlRFIHPyqiIC_YOSO2k9IkX9EfsR7ml5b9lROOf nKc7vsyky83qcPGcGuUVTnXY85N5wnCdDwvbtfllSpg_EzstR5y07t.Iypx8 6HFfgL9oXgSdOL7USWbf8LtkzklSy5VlpqkoFxXAFccR4EIG4WhJabH2qHhx qDMFxpRoN9wBuT7Jn5xeSycAaJ4L0ELTxZTqiBRlmJhlYfLrV8sBB3brbrdi jtx68qFeLHozMSGcxY_7d4.S5u3xJrxQkhabyMcjVzJ1da.loNdjMPSXHqnt RDViP0BKzfvuaTD_O0pD7eexOJy_p0k5m0j2WpudIuzCfeFuVTeWnXYqJOtR kg.Q8PqvTrvORDFTsZ8gI9Fe3JQYTWjFJ6hNKIHYQn3eYID_n6NX_3THfxUL xf2WKdgeblwY714S_cA3KPy5Xu2RJ40EA5fn6OL.gxeeVjZhErWQNZHXNB1x VfRol4fsmFJEp9fhmT5zZMiAt0kFFdw-- X-Yahoo-SMTP: gPXIZm2swBAFQJ_Vx0CebjUfUdhJ X-Rocket-Received: from goethe.lan (jon.maloy@65.93.115.57 with plain [208.71.40.208]) by smtp103.biz.mail.gq1.yahoo.com with SMTP; 14 May 2014 02:39:50 -0700 PDT From: Jon Maloy To: davem@davemloft.net Cc: netdev@vger.kernel.org, Paul Gortmaker , erik.hugne@ericsson.com, ying.xue@windriver.com, maloy@donjonn.com, tipc-discussion@lists.sourceforge.net, Jon Maloy Subject: [PATCH net-next v2 1/8] tipc: decrease connection flow control window Date: Wed, 14 May 2014 05:39:08 -0400 Message-Id: <1400060355-26308-2-git-send-email-jon.maloy@ericsson.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400060355-26308-1-git-send-email-jon.maloy@ericsson.com> References: <1400060355-26308-1-git-send-email-jon.maloy@ericsson.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Reviewed-by: Ying Xue --- net/tipc/core.c | 7 ++++--- net/tipc/port.h | 9 +++++---- net/tipc/socket.c | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/net/tipc/core.c b/net/tipc/core.c index 57f8ae9..676d180 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -154,10 +154,11 @@ static int __init tipc_init(void) tipc_max_ports = CONFIG_TIPC_PORTS; tipc_net_id = 4711; - sysctl_tipc_rmem[0] = CONN_OVERLOAD_LIMIT >> 4 << TIPC_LOW_IMPORTANCE; - sysctl_tipc_rmem[1] = CONN_OVERLOAD_LIMIT >> 4 << + sysctl_tipc_rmem[0] = TIPC_CONN_OVERLOAD_LIMIT >> 4 << + TIPC_LOW_IMPORTANCE; + sysctl_tipc_rmem[1] = TIPC_CONN_OVERLOAD_LIMIT >> 4 << TIPC_CRITICAL_IMPORTANCE; - sysctl_tipc_rmem[2] = CONN_OVERLOAD_LIMIT; + sysctl_tipc_rmem[2] = TIPC_CONN_OVERLOAD_LIMIT; res = tipc_core_start(); if (res) diff --git a/net/tipc/port.h b/net/tipc/port.h index a003973..5dfd165 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h @@ -42,9 +42,10 @@ #include "msg.h" #include "node_subscr.h" -#define TIPC_FLOW_CONTROL_WIN 512 -#define CONN_OVERLOAD_LIMIT ((TIPC_FLOW_CONTROL_WIN * 2 + 1) * \ - SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE)) +#define TIPC_CONNACK_INTV 256 +#define TIPC_FLOWCTRL_WIN (TIPC_CONNACK_INTV * 2) +#define TIPC_CONN_OVERLOAD_LIMIT ((TIPC_FLOWCTRL_WIN * 2 + 1) * \ + SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE)) /** * struct tipc_port - TIPC port structure @@ -187,7 +188,7 @@ static inline void tipc_port_unlock(struct tipc_port *p_ptr) static inline int tipc_port_congested(struct tipc_port *p_ptr) { - return (p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2); + return ((p_ptr->sent - p_ptr->acked) >= TIPC_FLOWCTRL_WIN); } diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 3f9912f..8685daf 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1101,7 +1101,7 @@ restart: /* Consume received message (optional) */ if (likely(!(flags & MSG_PEEK))) { if ((sock->state != SS_READY) && - (++port->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) + (++port->conn_unacked >= TIPC_CONNACK_INTV)) tipc_acknowledge(port->ref, port->conn_unacked); advance_rx_queue(sk); } @@ -1210,7 +1210,7 @@ restart: /* Consume received message (optional) */ if (likely(!(flags & MSG_PEEK))) { - if (unlikely(++port->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) + if (unlikely(++port->conn_unacked >= TIPC_CONNACK_INTV)) tipc_acknowledge(port->ref, port->conn_unacked); advance_rx_queue(sk); }