mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +00:00
Don't check the result of setting SO_INCOMING_CPU
The SO_INCOMING_CPU is available since Linux 3.19 for getting the value, but only since Linux 4.4 for setting the value (see below for a full description). BIND 9 should not fail when setting the option on the socket fails, as this is only an optimization and not hard requirement to run BIND 9. SO_INCOMING_CPU (gettable since Linux 3.19, settable since Linux 4.4) Sets or gets the CPU affinity of a socket. Expects an integer flag. int cpu = 1; setsockopt(fd, SOL_SOCKET, SO_INCOMING_CPU, &cpu, sizeof(cpu)); Because all of the packets for a single stream (i.e., all packets for the same 4-tuple) arrive on the single RX queue that is associated with a particular CPU, the typical use case is to employ one listening process per RX queue, with the incoming flow being handled by a listener on the same CPU that is handling the RX queue. This provides optimal NUMA behavior and keeps CPU caches hot.
This commit is contained in:
parent
0468454c0a
commit
4ec357da0a
@ -115,9 +115,12 @@ isc_nm_listenudp(isc_nm_t *mgr, isc_nmiface_t *iface, isc_nm_recv_cb_t cb,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SO_INCOMING_CPU
|
#ifdef SO_INCOMING_CPU
|
||||||
res = setsockopt(csock->fd, SOL_SOCKET, SO_INCOMING_CPU,
|
/* We don't check for the result, because SO_INCOMING_CPU can be
|
||||||
|
* available without the setter on Linux kernel version 4.4, and
|
||||||
|
* setting SO_INCOMING_CPU is just an optimization.
|
||||||
|
*/
|
||||||
|
(void)setsockopt(csock->fd, SOL_SOCKET, SO_INCOMING_CPU,
|
||||||
&(int){ 1 }, sizeof(int));
|
&(int){ 1 }, sizeof(int));
|
||||||
RUNTIME_CHECK(res == 0);
|
|
||||||
#endif
|
#endif
|
||||||
ievent = isc__nm_get_ievent(mgr, netievent_udplisten);
|
ievent = isc__nm_get_ievent(mgr, netievent_udplisten);
|
||||||
ievent->sock = csock;
|
ievent->sock = csock;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user