From 2328b6cd9cf7d61727fbd8e460eabc45e495191b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 3 Jan 2019 20:51:01 -0600 Subject: [PATCH] osd: report numa node for network interface(s) Signed-off-by: Sage Weil --- src/osd/OSD.cc | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 56d03f4e166..ab1a7db4d5a 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -50,6 +50,7 @@ #include "common/version.h" #include "common/pick_address.h" #include "common/blkdev.h" +#include "common/numa.h" #include "os/ObjectStore.h" #ifdef HAVE_LIBFUSE @@ -5785,6 +5786,43 @@ void OSD::_collect_metadata(map *pm) cct, cluster_messenger->get_myaddrs().front().get_sockaddr_storage()); + // network numa + { + int node = -1; + set nodes; + string cpu_list; + set unknown; + for (auto nm : { "front_iface", "back_iface" }) { + if (!(*pm)[nm].size()) { + unknown.insert(nm); + continue; + } + cpu_set_t cpu_set; + size_t cpu_set_size; + int n = -1; + int r = get_iface_numa_node((*pm)[nm], &n, &cpu_set_size, &cpu_set); + if (r < 0) { + unknown.insert((*pm)[nm]); + continue; + } + nodes.insert(n); + if (node < 0) { + node = n; + cpu_list = cpu_set_to_str_list(cpu_set_size, &cpu_set); + } + } + if (unknown.size()) { + (*pm)["network_numa_unknown_ifaces"] = stringify(unknown); + } + if (!nodes.empty()) { + (*pm)["network_numa_nodes"] = stringify(nodes); + } + if (node >= 0 && nodes.size() == 1 && unknown.empty()) { + (*pm)["network_numa_node"] = stringify(node); + (*pm)["network_numa_node_cpus"] = cpu_list; + } + } + set devnames; store->get_devices(&devnames); (*pm)["devices"] = stringify(devnames); -- 2.39.5