summaryrefslogtreecommitdiff
path: root/lib/ovs-numa.h
diff options
context:
space:
mode:
authorDaniele Di Proietto <diproiettod@vmware.com>2016-11-15 15:40:49 -0800
committerDaniele Di Proietto <diproiettod@vmware.com>2017-01-15 19:25:12 -0800
commitb2ce05edeef52770ab3e2dbd982d52c8d9124993 (patch)
tree4184ecf0622200b5b2f20a425a3153c478adc07f /lib/ovs-numa.h
parentf5d317a1568a21dbcde8c22db2a6f55aa15f0cd9 (diff)
downloadopenvswitch-b2ce05edeef52770ab3e2dbd982d52c8d9124993.tar.gz
ovs-numa: New ovs_numa_dump_contains_core() function.
It will be used by a future commit. struct ovs_numa_dump now uses an hmap instead of a list to make ovs_numa_dump_contains_core() more efficient. Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ilya Maximets <i.maximets@samsung.com>
Diffstat (limited to 'lib/ovs-numa.h')
-rw-r--r--lib/ovs-numa.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/ovs-numa.h b/lib/ovs-numa.h
index be836b2ca..c0eae07d8 100644
--- a/lib/ovs-numa.h
+++ b/lib/ovs-numa.h
@@ -21,19 +21,19 @@
#include <stdbool.h>
#include "compiler.h"
-#include "openvswitch/list.h"
+#include "openvswitch/hmap.h"
#define OVS_CORE_UNSPEC INT_MAX
#define OVS_NUMA_UNSPEC INT_MAX
/* Dump of a list of 'struct ovs_numa_info'. */
struct ovs_numa_dump {
- struct ovs_list dump;
+ struct hmap dump;
};
/* A numa_id - core_id pair. */
struct ovs_numa_info {
- struct ovs_list list_node;
+ struct hmap_node hmap_node;
int numa_id;
unsigned core_id;
};
@@ -54,10 +54,12 @@ unsigned ovs_numa_get_unpinned_core_any(void);
unsigned ovs_numa_get_unpinned_core_on_numa(int numa_id);
void ovs_numa_unpin_core(unsigned core_id);
struct ovs_numa_dump *ovs_numa_dump_cores_on_numa(int numa_id);
+bool ovs_numa_dump_contains_core(const struct ovs_numa_dump *,
+ int numa_id, unsigned core_id);
void ovs_numa_dump_destroy(struct ovs_numa_dump *);
int ovs_numa_thread_setaffinity_core(unsigned core_id);
#define FOR_EACH_CORE_ON_NUMA(ITER, DUMP) \
- LIST_FOR_EACH((ITER), list_node, &(DUMP)->dump)
+ HMAP_FOR_EACH((ITER), hmap_node, &(DUMP)->dump)
#endif /* ovs-numa.h */