Skip to content

Commit fee1af7

Browse files
author
Pavel Siska
committed
NfbPlugin: replace numa_bind with numa_set_preferred for flexible memory allocation
Switched from `numa_bind()` to `numa_set_preferred()` with `numa_set_bind_policy(0)` to allow preferred NUMA node memory allocation without hard binding. This enables memory to be allocated on the preferred NUMA node first, but allows fallback to others when necessary.
1 parent 00a630e commit fee1af7

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,12 @@ int NdpReader::init_interface(const std::string& interface)
6767
error_msg = std::string() + "error opening NDP queue of NFB device";
6868
return 1;
6969
}
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);
70+
if ((node_id = ndp_queue_get_numa_node(rx_handle)) >= 0) {
71+
// allow memory to be allocated on other nodes if preferred is unavailable
72+
numa_set_bind_policy(0);
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 setting failed\n";
7876
return 1;
7977
}
8078
if (ndp_queue_start(rx_handle)) { // start capturing data from NDP queue

0 commit comments

Comments
 (0)