From patchwork Thu Aug 26 10:54:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Ivanov X-Patchwork-Id: 1521036 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GwKVp1qszz9ssP for ; Thu, 26 Aug 2021 20:54:58 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 2B9C342611; Thu, 26 Aug 2021 10:54:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nyc-WHa2_0Qe; Thu, 26 Aug 2021 10:54:52 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 9EC53406CE; Thu, 26 Aug 2021 10:54:49 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id F114CC0021; Thu, 26 Aug 2021 10:54:47 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id CABF5C001A for ; Thu, 26 Aug 2021 10:54:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A698880F49 for ; Thu, 26 Aug 2021 10:54:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h6duKlXv6rXK for ; Thu, 26 Aug 2021 10:54:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from www.kot-begemot.co.uk (ivanoab7.miniserver.com [37.128.132.42]) by smtp1.osuosl.org (Postfix) with ESMTPS id 7BBEB80F2C for ; Thu, 26 Aug 2021 10:54:44 +0000 (UTC) Received: from tun252.jain.kot-begemot.co.uk ([192.168.18.6] helo=jain.kot-begemot.co.uk) by www.kot-begemot.co.uk with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mJD1p-0005r0-Ul for ovs-dev@openvswitch.org; Thu, 26 Aug 2021 10:54:42 +0000 Received: from jain.kot-begemot.co.uk ([192.168.3.3]) by jain.kot-begemot.co.uk with esmtp (Exim 4.92) (envelope-from ) id 1mJD1k-0000m3-7D; Thu, 26 Aug 2021 11:54:36 +0100 From: anton.ivanov@cambridgegreys.com To: ovs-dev@openvswitch.org Date: Thu, 26 Aug 2021 11:54:22 +0100 Message-Id: <20210826105423.2920-2-anton.ivanov@cambridgegreys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210826105423.2920-1-anton.ivanov@cambridgegreys.com> References: <20210826105423.2920-1-anton.ivanov@cambridgegreys.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett Cc: Anton Ivanov Subject: [ovs-dev] [OVN Patch v2 2/3] northd: Resize the hash to correct parameters after build X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Anton Ivanov Parallel builds may result in suboptimal hash bucket sizing. In the absense of dp-groups this does not matter as the hash is purely storage and not used for lookups during the build. Such a hash needs to be resized to a correct size at the end of the build to ensure that any lookups during the lflow reconcilliation phase are done as fast as possible. Signed-off-by: Anton Ivanov --- northd/ovn-northd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 8c653cf52..71458ff4e 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -13057,6 +13057,11 @@ build_lflows(struct northd_context *ctx, struct hmap *datapaths, igmp_groups, meter_groups, lbs, bfd_connections); + /* Parallel build may result in a suboptimal hash. Resize the + * hash to a correct size before doing lookups */ + + hmap_expand(&lflows); + if (hmap_count(&lflows) > max_seen_lflow_size) { max_seen_lflow_size = hmap_count(&lflows); }