Skip to content

Commit 926bb92

Browse files
authored
Merge pull request #300 from CESNET/nfb-numa-policy
NfbPlugin: use NUMA preferred policy instead of strict binding
2 parents 00a630e + b6112cb commit 926bb92

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/plugins/input/nfb/src/ndpReader.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,19 @@ int NdpReader::init_interface(const std::string& interface)
6060
return 1;
6161
}
6262

63-
struct bitmask* bits = nullptr;
6463
int node_id;
6564
rx_handle = ndp_open_rx_queue(dev_handle, channel);
6665
if (!rx_handle) {
6766
error_msg = std::string() + "error opening NDP queue of NFB device";
6867
return 1;
6968
}
70-
if (((node_id = ndp_queue_get_numa_node(rx_handle)) >= 0)
71-
&& // OPTIONAL: bind thread to correct NUMA node
72-
((bits = numa_allocate_nodemask()) != nullptr)) {
73-
(void) numa_bitmask_setbit(bits, node_id);
74-
numa_bind(bits);
75-
numa_free_nodemask(bits);
69+
if ((node_id = ndp_queue_get_numa_node(rx_handle)) >= 0) {
70+
// allow memory to be allocated on other nodes if preferred is unavailable
71+
constexpr int PREFERRED_NODE_POLICY = 0;
72+
numa_set_bind_policy(PREFERRED_NODE_POLICY);
73+
numa_set_preferred(node_id);
7674
} else {
77-
error_msg = std::string() + "warning - NUMA node binding failed\n";
75+
error_msg = "warning - NUMA node detection failed\n";
7876
return 1;
7977
}
8078
if (ndp_queue_start(rx_handle)) { // start capturing data from NDP queue

0 commit comments

Comments
 (0)