Since 18.05 release, DPDK moved to dynamic memory model in which hugepages could be allocated on demand. At the same time '--socket-mem' option was re-defined as a size of pre-allocated memory, i.e. memory that should be allocated at startup and could not be freed. So, DPDK with a new memory model could allocate more hugepage memory than specified in '--socket-mem' or '-m' options.
This change adds new configurable 'other_config:dpdk-socket-limit' which could be used to limit the ammount of memory DPDK could use. It uses new DPDK option '--socket-limit'. Ex.: ovs-vsctl set Open_vSwitch . other_config:dpdk-socket-limit="1024,1024" Also, in order to preserve old behaviour, if '--socket-limit' is not specified, it will be defaulted to the amount of memory specified by '--socket-mem' option, i.e. OVS will not be able to allocate more. This is needed, for example, to disallow OVS to allocate more memory than reserved for it by Nova in OpenStack installations. Signed-off-by: Ilya Maximets <i.maxim...@samsung.com> --- Argument parsing refactoring should be applied first. Based-on: https://patchwork.ozlabs.org/project/openvswitch/list/?series=87518 Aaron, what do you think about supporting tags like 'Based-on' in ovsrobot ? For example, patchew in QEMU parses 'Based-on: <Message-Id>' tags. Maybe we can use patchwork ids or something similar. NEWS | 3 +++ lib/dpdk.c | 21 +++++++++++++++++++-- vswitchd/vswitch.xml | 22 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 4985dbaac..a64b9d94d 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ Post-v2.11.0 --------------------- + - DPDK: + * New option 'other_config:dpdk-socket-limit' to limit amount of + hugepage memory that can be used by DPDK. v2.11.0 - xx xxx xxxx diff --git a/lib/dpdk.c b/lib/dpdk.c index 855bcf013..931249451 100644 --- a/lib/dpdk.c +++ b/lib/dpdk.c @@ -100,8 +100,9 @@ construct_dpdk_options(const struct smap *ovs_other_config, struct svec *args) bool default_enabled; const char *default_value; } opts[] = { - {"dpdk-lcore-mask", "-c", false, NULL}, - {"dpdk-hugepage-dir", "--huge-dir", false, NULL}, + {"dpdk-lcore-mask", "-c", false, NULL}, + {"dpdk-hugepage-dir", "--huge-dir", false, NULL}, + {"dpdk-socket-limit", "--socket-limit", false, NULL}, }; int i; @@ -318,6 +319,22 @@ dpdk_init__(const struct smap *ovs_other_config) svec_add(&args, ovs_get_program_name()); construct_dpdk_args(ovs_other_config, &args); + if (!args_contains(&args, "--legacy-mem") + && !args_contains(&args, "--socket-limit")) { + const char *arg; + size_t i; + + SVEC_FOR_EACH (i, arg, &args) { + if (!strcmp(arg, "--socket-mem")) { + break; + } + } + if (i < args.n - 1) { + svec_add(&args, "--socket-limit"); + svec_add(&args, args.names[i + 1]); + } + } + if (args_contains(&args, "-c") || args_contains(&args, "-l")) { auto_determine = false; } diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 88edb5d35..68da6f75c 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -333,6 +333,28 @@ </p> </column> + <column name="other_config" key="dpdk-socket-limit" + type='{"type": "string"}'> + <p> + Limits the maximum amount of memory that can be used from the + hugepage pool, on a per-socket basis. + </p> + <p> + The specifier is a comma-separated list of memory limits per socket. + <code>0</code> will disable the limit for a particular socket. + </p> + <p> + If not specified, OVS will configure limits equal to the amount of + preallocated memory specified by <ref column="other_config" + key="dpdk-socket-mem"/> or <code>--socket-mem</code> in + <ref column="other_config" key="dpdk-extra"/>. If none of the above + options specified or <code>--legacy-mem</code> provided in + <ref column="other_config" key="dpdk-extra"/>, limits will not be + applied. + Changing this value requires restarting the daemon. + </p> + </column> + <column name="other_config" key="dpdk-hugepage-dir" type='{"type": "string"}'> <p> -- 2.17.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev