Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1528441/?format=api
http://patchwork.ozlabs.org/api/patches/1528441/?format=api", "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20210915162144.28369-1-anton.ivanov@cambridgegreys.com/", "project": { "id": 68, "url": "http://patchwork.ozlabs.org/api/projects/68/?format=api", "name": "Open Virtual Network development", "link_name": "ovn", "list_id": "ovs-dev.openvswitch.org", "list_email": "ovs-dev@openvswitch.org", "web_url": "http://openvswitch.org/", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20210915162144.28369-1-anton.ivanov@cambridgegreys.com>", "list_archive_url": null, "date": "2021-09-15T16:21:44", "name": "[ovs-dev] northd: Optimize dp/lflow postprocessing", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "65ca3b3685de27664318cfe37e68d98aa021aa43", "submitter": { "id": 71996, "url": "http://patchwork.ozlabs.org/api/people/71996/?format=api", "name": "Anton Ivanov", "email": "anton.ivanov@cambridgegreys.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/ovn/patch/20210915162144.28369-1-anton.ivanov@cambridgegreys.com/mbox/", "series": [ { "id": 262489, "url": "http://patchwork.ozlabs.org/api/series/262489/?format=api", "web_url": "http://patchwork.ozlabs.org/project/ovn/list/?series=262489", "date": "2021-09-15T16:21:44", "name": "[ovs-dev] northd: Optimize dp/lflow postprocessing", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/262489/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1528441/comments/", "check": "fail", "checks": "http://patchwork.ozlabs.org/api/patches/1528441/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<ovs-dev-bounces@openvswitch.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "ovs-dev@openvswitch.org" ], "Delivered-To": [ "patchwork-incoming@ozlabs.org", "ovs-dev@lists.linuxfoundation.org" ], "Authentication-Results": "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=140.211.166.133; helo=smtp2.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)", "Received": [ "from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4H8lpx3Ybhz9sR4\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Sep 2021 02:22:01 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby smtp2.osuosl.org (Postfix) with ESMTP id 490994059F;\n\tWed, 15 Sep 2021 16:21:59 +0000 (UTC)", "from smtp2.osuosl.org ([127.0.0.1])\n\tby localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id XqEt6G2iGTwu; Wed, 15 Sep 2021 16:21:58 +0000 (UTC)", "from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp2.osuosl.org (Postfix) with ESMTPS id 2D94E4019A;\n\tWed, 15 Sep 2021 16:21:57 +0000 (UTC)", "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id E354EC0011;\n\tWed, 15 Sep 2021 16:21:56 +0000 (UTC)", "from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133])\n by lists.linuxfoundation.org (Postfix) with ESMTP id C23CCC000D\n for <ovs-dev@openvswitch.org>; Wed, 15 Sep 2021 16:21:55 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n by smtp2.osuosl.org (Postfix) with ESMTP id B07E34019A\n for <ovs-dev@openvswitch.org>; Wed, 15 Sep 2021 16:21:55 +0000 (UTC)", "from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id BVL66nEZCLIa for <ovs-dev@openvswitch.org>;\n Wed, 15 Sep 2021 16:21:54 +0000 (UTC)", "from www.kot-begemot.co.uk (ivanoab7.miniserver.com [37.128.132.42])\n by smtp2.osuosl.org (Postfix) with ESMTPS id 87E1E4026A\n for <ovs-dev@openvswitch.org>; Wed, 15 Sep 2021 16:21:54 +0000 (UTC)", "from tun252.jain.kot-begemot.co.uk ([192.168.18.6]\n helo=jain.kot-begemot.co.uk)\n by www.kot-begemot.co.uk with esmtps\n (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.92) (envelope-from <anton.ivanov@cambridgegreys.com>)\n id 1mQXfT-0001IV-JZ; Wed, 15 Sep 2021 16:21:51 +0000", "from jain.kot-begemot.co.uk ([192.168.3.3])\n by jain.kot-begemot.co.uk with esmtp (Exim 4.92)\n (envelope-from <anton.ivanov@cambridgegreys.com>)\n id 1mQXfP-0007UV-NZ; Wed, 15 Sep 2021 17:21:49 +0100" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "from auto-whitelisted by SQLgrey-1.8.0", "From": "anton.ivanov@cambridgegreys.com", "To": "ovs-dev@openvswitch.org", "Date": "Wed, 15 Sep 2021 17:21:44 +0100", "Message-Id": "<20210915162144.28369-1-anton.ivanov@cambridgegreys.com>", "X-Mailer": "git-send-email 2.20.1", "MIME-Version": "1.0", "X-Clacks-Overhead": "GNU Terry Pratchett", "Cc": "i.maximets@ovn.org, Anton Ivanov <anton.ivanov@cambridgegreys.com>", "Subject": "[ovs-dev] [OVN Patch] northd: Optimize dp/lflow postprocessing", "X-BeenThere": "ovs-dev@openvswitch.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "<ovs-dev.openvswitch.org>", "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <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 <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "ovs-dev-bounces@openvswitch.org", "Sender": "\"dev\" <ovs-dev-bounces@openvswitch.org>" }, "content": "From: Anton Ivanov <anton.ivanov@cambridgegreys.com>\n\n1. Compute dp group hash only if there will be dp group processing.\n2. Remove hmapx interim storage and related hmapx computation for\nsingle dp flows and replace it with a pre-sized hmap.\n\nSigned-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>\n---\n northd/ovn-northd.c | 55 ++++++++++++++++++++++++++++-----------------\n ovs | 2 +-\n 2 files changed, 36 insertions(+), 21 deletions(-)", "diff": "diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c\nindex baaddb73e..9edd1e0e4 100644\n--- a/northd/ovn-northd.c\n+++ b/northd/ovn-northd.c\n@@ -13178,6 +13178,11 @@ build_lflows(struct northd_context *ctx, struct hmap *datapaths,\n igmp_groups, meter_groups, lbs,\n bfd_connections);\n \n+ /* Parallel build may result in a suboptimal hash. Resize the\n+ * hash to a correct size before doing lookups */\n+\n+ hmap_expand(&lflows);\n+\n if (hmap_count(&lflows) > max_seen_lflow_size) {\n max_seen_lflow_size = hmap_count(&lflows);\n }\n@@ -13185,10 +13190,22 @@ build_lflows(struct northd_context *ctx, struct hmap *datapaths,\n stopwatch_start(LFLOWS_DP_GROUPS_STOPWATCH_NAME, time_msec());\n /* Collecting all unique datapath groups. */\n struct hmap dp_groups = HMAP_INITIALIZER(&dp_groups);\n- struct hmapx single_dp_lflows = HMAPX_INITIALIZER(&single_dp_lflows);\n- struct ovn_lflow *lflow;\n- HMAP_FOR_EACH (lflow, hmap_node, &lflows) {\n- uint32_t hash = hash_int(hmapx_count(&lflow->od_group), 0);\n+ struct hmap single_dp_lflows;\n+\n+ /* Single dp_flows will never grow bigger than lflows,\n+ * thus the two hmaps will remain the same size regardless\n+ * of how many elements we remove from lflows and add to\n+ * single_dp_lflows.\n+ * Note - lflows is always sized for max_seen_lflow_size.\n+ * If this iteration has resulted in a smaller lflow count,\n+ * the correct sizing is from the previous ones.\n+ */\n+ fast_hmap_size_for(&single_dp_lflows, max_seen_lflow_size);\n+\n+ struct ovn_lflow *lflow, *next_lflow;\n+ struct hmapx_node *node;\n+ HMAP_FOR_EACH_SAFE (lflow, next_lflow, hmap_node, &lflows) {\n+ uint32_t hash;\n struct ovn_dp_group *dpg;\n \n ovs_assert(hmapx_count(&lflow->od_group));\n@@ -13196,17 +13213,24 @@ build_lflows(struct northd_context *ctx, struct hmap *datapaths,\n if (hmapx_count(&lflow->od_group) == 1) {\n /* There is only one datapath, so it should be moved out of the\n * group to a single 'od'. */\n- const struct hmapx_node *node;\n HMAPX_FOR_EACH (node, &lflow->od_group) {\n lflow->od = node->data;\n break;\n }\n hmapx_clear(&lflow->od_group);\n+\n /* Logical flow should be re-hashed later to allow lookups. */\n- hmapx_add(&single_dp_lflows, lflow);\n+ hash = hmap_node_hash(&lflow->hmap_node);\n+ /* Remove from lflows. */\n+ hmap_remove(&lflows, &lflow->hmap_node);\n+ hash = ovn_logical_flow_hash_datapath(&lflow->od->sb->header_.uuid,\n+ hash);\n+ /* Add to single_dp_lflows. */\n+ hmap_insert_fast(&single_dp_lflows, &lflow->hmap_node, hash);\n continue;\n }\n \n+ hash = hash_int(hmapx_count(&lflow->od_group), 0);\n dpg = ovn_dp_group_find(&dp_groups, &lflow->od_group, hash);\n if (!dpg) {\n dpg = xzalloc(sizeof *dpg);\n@@ -13216,19 +13240,11 @@ build_lflows(struct northd_context *ctx, struct hmap *datapaths,\n lflow->dpg = dpg;\n }\n \n- /* Adding datapath to the flow hash for logical flows that have only one,\n- * so they could be found by the southbound db record. */\n- const struct hmapx_node *node;\n- uint32_t hash;\n- HMAPX_FOR_EACH (node, &single_dp_lflows) {\n- lflow = node->data;\n- hash = hmap_node_hash(&lflow->hmap_node);\n- hmap_remove(&lflows, &lflow->hmap_node);\n- hash = ovn_logical_flow_hash_datapath(&lflow->od->sb->header_.uuid,\n- hash);\n- hmap_insert(&lflows, &lflow->hmap_node, hash);\n- }\n- hmapx_destroy(&single_dp_lflows);\n+ /* Merge multiple and single dp hashes. */\n+\n+ fast_hmap_merge(&lflows, &single_dp_lflows);\n+\n+ hmap_destroy(&single_dp_lflows);\n \n /* Push changes to the Logical_Flow table to database. */\n const struct sbrec_logical_flow *sbflow, *next_sbflow;\n@@ -13361,7 +13377,6 @@ build_lflows(struct northd_context *ctx, struct hmap *datapaths,\n }\n \n stopwatch_stop(LFLOWS_DP_GROUPS_STOPWATCH_NAME, time_msec());\n- struct ovn_lflow *next_lflow;\n HMAP_FOR_EACH_SAFE (lflow, next_lflow, hmap_node, &lflows) {\n const char *pipeline = ovn_stage_get_pipeline_name(lflow->stage);\n uint8_t table = ovn_stage_get_table(lflow->stage);\n", "prefixes": [ "ovs-dev" ] }{ "id": 1528441, "url": "