get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/812518/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 812518,
    "url": "http://patchwork.ozlabs.org/api/patches/812518/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/1505152570-6143-4-git-send-email-gvrose8192@gmail.com/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/projects/47/?format=api",
        "name": "Open vSwitch",
        "link_name": "openvswitch",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "git@github.com:openvswitch/ovs.git",
        "webscm_url": "https://github.com/openvswitch/ovs",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1505152570-6143-4-git-send-email-gvrose8192@gmail.com>",
    "list_archive_url": null,
    "date": "2017-09-11T17:55:59",
    "name": "[ovs-dev,04/15] datapath: Optimize operations for OvS flow_stats.",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "080094914cb7705e36d0a737a970089b7bece7ba",
    "submitter": {
        "id": 69140,
        "url": "http://patchwork.ozlabs.org/api/people/69140/?format=api",
        "name": "Gregory Rose",
        "email": "gvrose8192@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/1505152570-6143-4-git-send-email-gvrose8192@gmail.com/mbox/",
    "series": [
        {
            "id": 2537,
            "url": "http://patchwork.ozlabs.org/api/series/2537/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=2537",
            "date": "2017-09-11T17:55:56",
            "name": "[ovs-dev,01/15] acinclude: Check for SKB_GSO_UDP",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/2537/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/812518/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/812518/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ovs-dev-bounces@openvswitch.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "dev@openvswitch.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "ovs-dev@mail.linuxfoundation.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"HwzaI3tx\"; dkim-atps=neutral"
        ],
        "Received": [
            "from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xrbJ56GrDz9s7F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 03:58:13 +1000 (AEST)",
            "from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 49652B0A;\n\tMon, 11 Sep 2017 17:56:24 +0000 (UTC)",
            "from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 36A61AC9\n\tfor <dev@openvswitch.org>; Mon, 11 Sep 2017 17:56:23 +0000 (UTC)",
            "from mail-pf0-f195.google.com (mail-pf0-f195.google.com\n\t[209.85.192.195])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9A2DCD3\n\tfor <dev@openvswitch.org>; Mon, 11 Sep 2017 17:56:22 +0000 (UTC)",
            "by mail-pf0-f195.google.com with SMTP id e69so3400875pfg.4\n\tfor <dev@openvswitch.org>; Mon, 11 Sep 2017 10:56:22 -0700 (PDT)",
            "from gizo.domain (67-5-132-83.ptld.qwest.net. [67.5.132.83])\n\tby smtp.gmail.com with ESMTPSA id\n\th185sm16733084pfe.160.2017.09.11.10.56.20\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 11 Sep 2017 10:56:20 -0700 (PDT)"
        ],
        "X-Greylist": "whitelisted by SQLgrey-1.7.6",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=/XSTG34Q8GxNSzWNs3owPR5+/APDMgxxJfnT4f3elck=;\n\tb=HwzaI3txac/5Rhdu60gFtXZSxxIaZ1NZ6ANOFfySBKy0B4BsE5njdIYMfUJyhEHDbP\n\tkJ1Dlb7vprYBRtSMndP1/NDfUJnEbIjD2LxSlVBVt/cN/hfl77KBiBIF0qC++/hFFCCA\n\thLm5ZpZ6VvNayhBHFw3C0I08oeZtv+JHsjWx45kr+3uABf/t6QWpJ6OK6pRGN7QzFglx\n\t70aXWgLgQV+lFOlSSuHQLqW6yEb4cJgQc6DYDjdJTm+nmLNiv5kdETqnJQVYEMDraXkB\n\t32HikndtmyLaW+CsvvxYha7mzp5o2Sf7LGlrkTuOOFM2ZjnG9O/08tQB6dupfjXF/2Hj\n\tl6XA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=/XSTG34Q8GxNSzWNs3owPR5+/APDMgxxJfnT4f3elck=;\n\tb=AFbZmp4WBZOoXifbr4rgvUYpwH5Ij0vxJ9oh8bQy8zURog0GwLLU9Rl3vjqm3glpyQ\n\tgwtKg/eqjQiEHam9a8WnqhWxbt42xqxY3y9dYptasOHLxepo1d77g8uMXuqjV6tNZD1S\n\twbuRmB7Aueo2ZtWMztbcmsvPvK0pq6x3EkeKCvGKU+ykz9Ms0AzCJg68LvQEwudgxrIS\n\tCWlrzCOfVZK2j1bn1OoVh9FNmBgU9S5/cown8qPeQHytoNlzvvPE7C4RwNURl7YQnU6O\n\t9vzov7kzGEsadMM2T3tyysh8Om6Pzfw/pphT93yxULBWyFPwx6IjkwxE6IKohaYgoh+v\n\twEBg==",
        "X-Gm-Message-State": "AHPjjUjRl9s+qF8YVLvYx5Bhl9nCYaUroU+YzJy9aEV8r5L0Okuziu9w\n\tRbHrf6WRDmcfc6os",
        "X-Google-Smtp-Source": "ADKCNb4hVCoDu0+2KoLS7vYmN1OhZskq0Y/JpnAhBSpPBw3Tx1PaTlIJAx10lqBgmX3AuSprQvZlNw==",
        "X-Received": "by 10.98.204.69 with SMTP id a66mr12854833pfg.132.1505152581736; \n\tMon, 11 Sep 2017 10:56:21 -0700 (PDT)",
        "From": "Greg Rose <gvrose8192@gmail.com>",
        "To": "dev@openvswitch.org",
        "Date": "Mon, 11 Sep 2017 10:55:59 -0700",
        "Message-Id": "<1505152570-6143-4-git-send-email-gvrose8192@gmail.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1505152570-6143-1-git-send-email-gvrose8192@gmail.com>",
        "References": "<1505152570-6143-1-git-send-email-gvrose8192@gmail.com>",
        "MIME-Version": "1.0",
        "X-Spam-Status": "No, score=0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tDKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, \n\tRCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1",
        "X-Spam-Checker-Version": "SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org",
        "Subject": "[ovs-dev] [PATCH 04/15] datapath: Optimize operations for OvS\n\tflow_stats.",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.12",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>",
        "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>",
        "List-Post": "<mailto:ovs-dev@openvswitch.org>",
        "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>",
        "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Sender": "ovs-dev-bounces@openvswitch.org",
        "Errors-To": "ovs-dev-bounces@openvswitch.org"
    },
    "content": "Upstream commit:\n    commit c4b2bf6b4a35348fe6d1eb06928eb68d7b9d99a9\n    Author: Tonghao Zhang <xiangxia.m.yue@gmail.com>\n    Date:   Mon Jul 17 23:28:06 2017 -0700\n\n    openvswitch: Optimize operations for OvS flow_stats.\n\n    When calling the flow_free() to free the flow, we call many times\n    (cpu_possible_mask, eg. 128 as default) cpumask_next(). That will\n    take up our CPU usage if we call the flow_free() frequently.\n    When we put all packets to userspace via upcall, and OvS will send\n    them back via netlink to ovs_packet_cmd_execute(will call flow_free).\n\n    The test topo is shown as below. VM01 sends TCP packets to VM02,\n    and OvS forward packtets. When testing, we use perf to report the\n    system performance.\n\n    VM01 --- OvS-VM --- VM02\n\n    Without this patch, perf-top show as below: The flow_free() is\n    3.02% CPU usage.\n\n        4.23%  [kernel]            [k] _raw_spin_unlock_irqrestore\n        3.62%  [kernel]            [k] __do_softirq\n        3.16%  [kernel]            [k] __memcpy\n        3.02%  [kernel]            [k] flow_free\n        2.42%  libc-2.17.so        [.] __memcpy_ssse3_back\n        2.18%  [kernel]            [k] copy_user_generic_unrolled\n        2.17%  [kernel]            [k] find_next_bit\n\n    When applied this patch, perf-top show as below: Not shown on\n    the list anymore.\n\n        4.11%  [kernel]            [k] _raw_spin_unlock_irqrestore\n        3.79%  [kernel]            [k] __do_softirq\n        3.46%  [kernel]            [k] __memcpy\n        2.73%  libc-2.17.so        [.] __memcpy_ssse3_back\n        2.25%  [kernel]            [k] copy_user_generic_unrolled\n        1.89%  libc-2.17.so        [.] _int_malloc\n        1.53%  ovs-vswitchd        [.] xlate_actions\n\n    With this patch, the TCP throughput(we dont use Megaflow Cache\n    + Microflow Cache) between VMs is 1.18Gbs/sec up to 1.30Gbs/sec\n    (maybe ~10% performance imporve).\n\n    This patch adds cpumask struct, the cpu_used_mask stores the cpu_id\n    that the flow used. And we only check the flow_stats on the cpu we\n    used, and it is unncessary to check all possible cpu when getting,\n    cleaning, and updating the flow_stats. Adding the cpu_used_mask to\n    sw_flow struct does’t increase the cacheline number.\n\n    Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>\n    Acked-by: Pravin B Shelar <pshelar@ovn.org>\n    Signed-off-by: David S. Miller <davem@davemloft.net>\n\nSigned-off-by: Greg Rose <gvrose8192@gmail.com>\n---\n datapath/flow.c       | 7 ++++---\n datapath/flow.h       | 2 ++\n datapath/flow_table.c | 4 +++-\n 3 files changed, 9 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/datapath/flow.c b/datapath/flow.c\nindex 30e4d21..5da7e3e 100644\n--- a/datapath/flow.c\n+++ b/datapath/flow.c\n@@ -71,7 +71,7 @@ void ovs_flow_stats_update(struct sw_flow *flow, __be16 tcp_flags,\n \t\t\t   const struct sk_buff *skb)\n {\n \tstruct flow_stats *stats;\n-\tint cpu = smp_processor_id();\n+\tunsigned int cpu = smp_processor_id();\n \tint len = skb->len + (skb_vlan_tag_present(skb) ? VLAN_HLEN : 0);\n \n \tstats = rcu_dereference(flow->stats[cpu]);\n@@ -116,6 +116,7 @@ void ovs_flow_stats_update(struct sw_flow *flow, __be16 tcp_flags,\n \n \t\t\t\t\trcu_assign_pointer(flow->stats[cpu],\n \t\t\t\t\t\t\t   new_stats);\n+\t\t\t\t\tcpumask_set_cpu(cpu, &flow->cpu_used_mask);\n \t\t\t\t\tgoto unlock;\n \t\t\t\t}\n \t\t\t}\n@@ -143,7 +144,7 @@ void ovs_flow_stats_get(const struct sw_flow *flow,\n \tmemset(ovs_stats, 0, sizeof(*ovs_stats));\n \n \t/* We open code this to make sure cpu 0 is always considered */\n-\tfor (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, cpu_possible_mask)) {\n+\tfor (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, &flow->cpu_used_mask)) {\n \t\tstruct flow_stats *stats = rcu_dereference_ovsl(flow->stats[cpu]);\n \n \t\tif (stats) {\n@@ -167,7 +168,7 @@ void ovs_flow_stats_clear(struct sw_flow *flow)\n \tint cpu;\n \n \t/* We open code this to make sure cpu 0 is always considered */\n-\tfor (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, cpu_possible_mask)) {\n+\tfor (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, &flow->cpu_used_mask)) {\n \t\tstruct flow_stats *stats = ovsl_dereference(flow->stats[cpu]);\n \n \t\tif (stats) {\ndiff --git a/datapath/flow.h b/datapath/flow.h\nindex 07af912..0796b09 100644\n--- a/datapath/flow.h\n+++ b/datapath/flow.h\n@@ -31,6 +31,7 @@\n #include <linux/jiffies.h>\n #include <linux/time.h>\n #include <linux/flex_array.h>\n+#include <linux/cpumask.h>\n #include <net/inet_ecn.h>\n #include <net/ip_tunnels.h>\n #include <net/dst_metadata.h>\n@@ -218,6 +219,7 @@ struct sw_flow {\n \t\t\t\t\t */\n \tstruct sw_flow_key key;\n \tstruct sw_flow_id id;\n+\tstruct cpumask cpu_used_mask;\n \tstruct sw_flow_mask *mask;\n \tstruct sw_flow_actions __rcu *sf_acts;\n \tstruct flow_stats __rcu *stats[]; /* One for each CPU.  First one\ndiff --git a/datapath/flow_table.c b/datapath/flow_table.c\nindex 6fe3739..47057a1 100644\n--- a/datapath/flow_table.c\n+++ b/datapath/flow_table.c\n@@ -104,6 +104,8 @@ struct sw_flow *ovs_flow_alloc(void)\n \n \tRCU_INIT_POINTER(flow->stats[0], stats);\n \n+\tcpumask_set_cpu(0, &flow->cpu_used_mask);\n+\n \treturn flow;\n err:\n \tkmem_cache_free(flow_cache, flow);\n@@ -147,7 +149,7 @@ static void flow_free(struct sw_flow *flow)\n \tif (flow->sf_acts)\n \t\tovs_nla_free_flow_actions((struct sw_flow_actions __force *)flow->sf_acts);\n \t/* We open code this to make sure cpu 0 is always considered */\n-\tfor (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, cpu_possible_mask))\n+\tfor (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, &flow->cpu_used_mask))\n \t\tif (flow->stats[cpu])\n \t\t\tkmem_cache_free(flow_stats_cache,\n \t\t\t\t\trcu_dereference_raw(flow->stats[cpu]));\n",
    "prefixes": [
        "ovs-dev",
        "04/15"
    ]
}