Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/805948/?format=api
{ "id": 805948, "url": "http://patchwork.ozlabs.org/api/patches/805948/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170825152449.29790-1-jacob.e.keller@intel.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170825152449.29790-1-jacob.e.keller@intel.com>", "list_archive_url": null, "date": "2017-08-25T15:24:49", "name": "[RFC] net: limit maximum number of packets to mark with xmit_more", "commit_ref": null, "pull_url": null, "state": "rfc", "archived": true, "hash": "b5767ad1382c393d1d2d808e96b7da39d46e4758", "submitter": { "id": 9784, "url": "http://patchwork.ozlabs.org/api/people/9784/?format=api", "name": "Jacob Keller", "email": "jacob.e.keller@intel.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170825152449.29790-1-jacob.e.keller@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/805948/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/805948/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xf4jC2r6lz9sP5\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 26 Aug 2017 01:25:03 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S933689AbdHYPZA (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 25 Aug 2017 11:25:00 -0400", "from mga11.intel.com ([192.55.52.93]:38164 \"EHLO mga11.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S933386AbdHYPY7 (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tFri, 25 Aug 2017 11:24:59 -0400", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Aug 2017 08:24:56 -0700", "from jekeller-desk.amr.corp.intel.com ([134.134.177.230])\n\tby orsmga003.jf.intel.com with ESMTP; 25 Aug 2017 08:24:56 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.41,426,1498546800\"; d=\"scan'208\";a=\"1007629496\"", "From": "Jacob Keller <jacob.e.keller@intel.com>", "To": "netdev@vger.kernel.org", "Cc": "Jacob Keller <jacob.e.keller@intel.com>", "Subject": "[RFC PATCH] net: limit maximum number of packets to mark with\n\txmit_more", "Date": "Fri, 25 Aug 2017 08:24:49 -0700", "Message-Id": "<20170825152449.29790-1-jacob.e.keller@intel.com>", "X-Mailer": "git-send-email 2.14.1.436.g33e61a4f0239", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "Under some circumstances, such as with many stacked devices, it is\npossible that dev_hard_start_xmit will bundle many packets together, and\nmark them all with xmit_more.\n\nMost drivers respond to xmit_more by skipping tail bumps on packet\nrings, or similar behavior as long as xmit_more is set. This is\na performance win since it means drivers can avoid notifying hardware of\nnew packets repeat daily, and thus avoid wasting unnecessary PCIe or other\nbandwidth.\n\nThis use of xmit_more comes with a trade off because bundling too many\npackets can increase latency of the Tx packets. To avoid this, we should\nlimit the maximum number of packets with xmit_more.\n\nDriver authors could modify their drivers to check for some determined\nlimit, but this requires all drivers to be modified in order to gain\nadvantage.\n\nInstead, add a sysctl \"xmit_more_max\" which can be used to configure the\nmaximum number of xmit_more skbs to send in a sequence. This ensures\nthat all drivers benefit, and allows system administrators the option to\ntune the value to their environment.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n\nStray thoughts and further questions....\n\nIs this the right approach? Did I miss any other places where we should\nlimit? Does the limit make sense? Should it instead be a per-device\ntuning nob instead of a global? Is 32 a good default?\n\n Documentation/sysctl/net.txt | 6 ++++++\n include/linux/netdevice.h | 2 ++\n net/core/dev.c | 10 +++++++++-\n net/core/sysctl_net_core.c | 7 +++++++\n 4 files changed, 24 insertions(+), 1 deletion(-)", "diff": "diff --git a/Documentation/sysctl/net.txt b/Documentation/sysctl/net.txt\nindex b67044a2575f..3d995e8f4448 100644\n--- a/Documentation/sysctl/net.txt\n+++ b/Documentation/sysctl/net.txt\n@@ -230,6 +230,12 @@ netdev_max_backlog\n Maximum number of packets, queued on the INPUT side, when the interface\n receives packets faster than kernel can process them.\n \n+xmit_more_max\n+-------------\n+\n+Maximum number of packets in a row to mark with skb->xmit_more. A value of zero\n+indicates no limit.\n+\n netdev_rss_key\n --------------\n \ndiff --git a/include/linux/netdevice.h b/include/linux/netdevice.h\nindex c5475b37a631..6341452aed09 100644\n--- a/include/linux/netdevice.h\n+++ b/include/linux/netdevice.h\n@@ -3321,6 +3321,8 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);\n extern int\t\tnetdev_budget;\n extern unsigned int\tnetdev_budget_usecs;\n \n+extern unsigned int sysctl_xmit_more_max;\n+\n /* Called by rtnetlink.c:rtnl_unlock() */\n void netdev_run_todo(void);\n \ndiff --git a/net/core/dev.c b/net/core/dev.c\nindex 270b54754821..d9946d29c3a5 100644\n--- a/net/core/dev.c\n+++ b/net/core/dev.c\n@@ -2983,12 +2983,19 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *first, struct net_device *de\n {\n \tstruct sk_buff *skb = first;\n \tint rc = NETDEV_TX_OK;\n+\tint xmit_count = 0;\n+\tbool more = true;\n \n \twhile (skb) {\n \t\tstruct sk_buff *next = skb->next;\n \n+\t\tif (sysctl_xmit_more_max)\n+\t\t\tmore = xmit_count++ < sysctl_xmit_more_max;\n+\t\tif (!more)\n+\t\t\txmit_count = 0;\n+\n \t\tskb->next = NULL;\n-\t\trc = xmit_one(skb, dev, txq, next != NULL);\n+\t\trc = xmit_one(skb, dev, txq, more && next != NULL);\n \t\tif (unlikely(!dev_xmit_complete(rc))) {\n \t\t\tskb->next = next;\n \t\t\tgoto out;\n@@ -3523,6 +3530,7 @@ EXPORT_SYMBOL(netdev_max_backlog);\n int netdev_tstamp_prequeue __read_mostly = 1;\n int netdev_budget __read_mostly = 300;\n unsigned int __read_mostly netdev_budget_usecs = 2000;\n+unsigned int __read_mostly sysctl_xmit_more_max = 32;\n int weight_p __read_mostly = 64; /* old backlog weight */\n int dev_weight_rx_bias __read_mostly = 1; /* bias for backlog weight */\n int dev_weight_tx_bias __read_mostly = 1; /* bias for output_queue quota */\ndiff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c\nindex b7cd9aafe99e..6950e702e101 100644\n--- a/net/core/sysctl_net_core.c\n+++ b/net/core/sysctl_net_core.c\n@@ -460,6 +460,13 @@ static struct ctl_table net_core_table[] = {\n \t\t.proc_handler\t= proc_dointvec_minmax,\n \t\t.extra1\t\t= &zero,\n \t},\n+\t{\n+\t\t.procname\t= \"xmit_more_max\",\n+\t\t.data\t\t= &sysctl_xmit_more_max,\n+\t\t.maxlen\t\t= sizeof(unsigned int),\n+\t\t.mode\t\t= 0644,\n+\t\t.prox_handler\t= proc_dointvec\n+\t},\n \t{ }\n };\n \n", "prefixes": [ "RFC" ] }