[ovs-dev] [PATCH v4 2/2] ovs-numa: Dpdk options with non-contiguous nodes
David Wilder
dwilder at us.ibm.com
Wed May 19 00:10:08 UTC 2021
If not supplied by the user --socket-mem and --socket-limit EAL options
are set to a default value based system topology. The assumption that
numa nodes must be numbered contiguously is removed by this change.
These options can be seen in the ovs-vswitchd.log. For example:
a system containing only numa nodes 0 and 8 will generate the following:
EAL ARGS: ovs-vswitchd --socket-mem 1024,0,0,0,0,0,0,0,1024 \
--socket-limit 1024,0,0,0,0,0,0,0,1024 -l 0
Signed-off-by: David Wilder <dwilder at us.ibm.com>
Reviewed-by: David Christensen <drc at linux.vnet.ibm.com>
---
lib/dpdk.c | 26 ++++++++++++++++++--------
lib/ovs-numa.c | 1 -
lib/ovs-numa.h | 2 ++
3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/lib/dpdk.c b/lib/dpdk.c
index 3195403..918bc80 100644
--- a/lib/dpdk.c
+++ b/lib/dpdk.c
@@ -133,18 +133,28 @@ static char *
construct_dpdk_socket_mem(void)
{
const char *def_value = "1024";
- int numa, numa_nodes = ovs_numa_get_n_numas();
+ struct ovs_numa_dump *dump;
+ int last_node = 0;
+
+ /* Build a list of all numa nodes with at least one core */
+ dump = ovs_numa_dump_n_cores_per_numa(1);
struct ds dpdk_socket_mem = DS_EMPTY_INITIALIZER;
+ ds_put_cstr(&dpdk_socket_mem, def_value);
- if (numa_nodes == 0 || numa_nodes == OVS_NUMA_UNSPEC) {
- numa_nodes = 1;
- }
+ const struct ovs_numa_info_numa *node;
- ds_put_cstr(&dpdk_socket_mem, def_value);
- for (numa = 1; numa < numa_nodes; ++numa) {
- ds_put_format(&dpdk_socket_mem, ",%s", def_value);
+ FOR_EACH_NUMA_ON_DUMP(node, dump) {
+ while (node->numa_id > last_node+1 &&
+ node->numa_id != OVS_NUMA_UNSPEC &&
+ node->numa_id <= MAX_NUMA_NODES){
+ ds_put_format(&dpdk_socket_mem, ",%s", "0");
+ ++last_node;
+ }
+ if (node->numa_id != 0) {
+ ds_put_format(&dpdk_socket_mem, ",%s", def_value);
+ }
}
-
+ ovs_numa_dump_destroy(dump);
return ds_cstr(&dpdk_socket_mem);
}
diff --git a/lib/ovs-numa.c b/lib/ovs-numa.c
index d2e7cc6..de1d037 100644
--- a/lib/ovs-numa.c
+++ b/lib/ovs-numa.c
@@ -58,7 +58,6 @@ VLOG_DEFINE_THIS_MODULE(ovs_numa);
* TODO: Fix ovs-numa when cpu hotplug is used.
*/
-#define MAX_NUMA_NODES 128
/* numa node. */
struct numa_node {
diff --git a/lib/ovs-numa.h b/lib/ovs-numa.h
index 8f2ea34..ecc251a 100644
--- a/lib/ovs-numa.h
+++ b/lib/ovs-numa.h
@@ -26,6 +26,8 @@
#define OVS_CORE_UNSPEC INT_MAX
#define OVS_NUMA_UNSPEC INT_MAX
+#define MAX_NUMA_NODES 128
+
/* Dump of a list of 'struct ovs_numa_info'. */
struct ovs_numa_dump {
struct hmap cores;
--
1.8.3.1
More information about the dev
mailing list