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; }