mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +00:00
dpdk: Limit DPDK memory usage.
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.maximets@samsung.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
This commit is contained in:
committed by
Ian Stokes
parent
dbcb014d1f
commit
8411b6ccec
21
lib/dpdk.c
21
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user