From patchwork Wed Dec 15 13:25:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1568237 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=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JDbbY4H7yz9sXS for ; Thu, 16 Dec 2021 00:25:43 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C65D1414E5; Wed, 15 Dec 2021 13:25:40 +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 V3M7knxzpEoS; Wed, 15 Dec 2021 13:25:40 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 060DF40895; Wed, 15 Dec 2021 13:25:39 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D99F1C001E; Wed, 15 Dec 2021 13:25:38 +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 18DECC0012 for ; Wed, 15 Dec 2021 13:25:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id EE9F081CE3 for ; Wed, 15 Dec 2021 13:25:36 +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 k_GZhKZbbW4q for ; Wed, 15 Dec 2021 13:25:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.osuosl.org (Postfix) with ESMTPS id BE12581CA5 for ; Wed, 15 Dec 2021 13:25:35 +0000 (UTC) Received: (Authenticated sender: i.maximets@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id E40C31C000F; Wed, 15 Dec 2021 13:25:30 +0000 (UTC) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Wed, 15 Dec 2021 14:25:25 +0100 Message-Id: <20211215132525.1453496-1-i.maximets@ovn.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Cc: Flavio Leitner , David Marchand Subject: [ovs-dev] [PATCH v2] dpdk: Use --in-memory by default. 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: Rosemarie O'Riorden If anonymous memory mapping is supported by the kernel, it's better to run OVS entirely in memory rather than creating shared data structures. OVS doesn't work in multi-process mode, so there is no need to litter a filesystem. Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1949849 Signed-off-by: Rosemarie O'Riorden Acked-by: David Marchand --- Version 2: - Adjusted the commit message as per David's comments. - Restored original authorship (I hope that git send-email tracked that correctly as I didn't re-send someone else's patches for a while). - Minor rebase, typo fix. - Re-sending to remind others about the patch and address all the minor comments, so it's in a good shape. NEWS | 1 + acinclude.m4 | 6 ++++++ lib/dpdk.c | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/NEWS b/NEWS index 2a4856c1a..c47a6be50 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ Post-v2.16.0 by default. 'other_config:dpdk-socket-limit' can be set equal to the 'other_config:dpdk-socket-mem' to preserve the legacy memory limiting behavior. + * EAL argument --in-memory is applied by default if supported. * Add hardware offload support for matching IPv4/IPv6 frag types (experimental). * Add support for DPDK 21.11. diff --git a/acinclude.m4 b/acinclude.m4 index 8ab690f47..23cd6df44 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -472,6 +472,12 @@ AC_DEFUN([OVS_CHECK_DPDK], [ ], [[#include ]]) ], [], [[#include ]]) + AC_CHECK_DECL([MAP_HUGE_SHIFT], [ + AC_DEFINE([DPDK_IN_MEMORY_SUPPORTED], [1], [If MAP_HUGE_SHIFT is + defined, anonymous memory mapping is supported by the + kernel, and --in-memory can be used.]) + ], [], [[#include ]]) + # DPDK uses dlopen to load plugins. OVS_FIND_DEPENDENCY([dlopen], [dl], [libdl]) diff --git a/lib/dpdk.c b/lib/dpdk.c index b2ef31cd2..6cdd69bd2 100644 --- a/lib/dpdk.c +++ b/lib/dpdk.c @@ -405,6 +405,13 @@ dpdk_init__(const struct smap *ovs_other_config) svec_add(&args, ovs_get_program_name()); construct_dpdk_args(ovs_other_config, &args); +#ifdef DPDK_IN_MEMORY_SUPPORTED + if (!args_contains(&args, "--in-memory") && + !args_contains(&args, "--legacy-mem")) { + svec_add(&args, "--in-memory"); + } +#endif + if (args_contains(&args, "-c") || args_contains(&args, "-l")) { auto_determine = false; }