]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use the original threadid when sending a UDP packet to decrease probability of contex...
authorWitold Kręcicki <wpk@isc.org>
Wed, 29 Jan 2020 08:29:19 +0000 (09:29 +0100)
committerWitold Kręcicki <wpk@isc.org>
Fri, 28 Feb 2020 07:46:16 +0000 (08:46 +0100)
lib/isc/netmgr/udp.c

index 6e229e1eea66efbfb54adefc02563835929f2ed7..84ac0d65278c6c394a2a9f9078a10fe3dd4572f8 100644 (file)
@@ -383,8 +383,16 @@ isc__nm_udp_send(isc_nmhandle_t *handle, isc_region_t *region, isc_nm_cb_t cb,
                return (ISC_R_CANCELED);
        }
 
+       /*
+        * If we're in netthread - send it directly
+        * If the original packet was received over a regular socket
+        * - send it over the same thread (assuming cpu affinity)
+        * Otherwise - use a random thread.
+        */
        if (isc__nm_in_netthread()) {
                ntid = isc_nm_tid();
+       } else if (sock->type == isc_nm_udpsocket) {
+               ntid = sock->tid;
        } else {
                ntid = (int)isc_random_uniform(sock->nchildren);
        }