mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-28 04:21:07 -05:00
Use the original threadid when sending a UDP packet to decrease probability of context switching
This commit is contained in:
parent
c324230c6f
commit
eb874608c1
1 changed files with 8 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue