shithub: riscv

Download patch

ref: 69e9efa847c03924caef9db2a0a4db586ddcc2f9
parent: 6fbf81a98f8f747444cfe0e7a0591f6de511e510
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Oct 15 17:20:30 EDT 2023

ndb/dns: avoid blocking 9p on refresh, use shorter 15second query timeout, cleanup

When writing "refresh" control message to trigger
garbage collection and there are other (query) processes active,
the 9p loop would block until these processes complete.

Instead, defer the garbage collection operation to these
outstanding processes once any of them completes,
keeping the 9p loop un-contended for longer.

When theres no other processes, we can garbage collect
ourselfs immediately (just as before).

Only acquire the dnvars lock on Twrite, so we can handle
other 9p requests while garbage collection is going on.

Also reduce the 60 second timeout to 15 second for queries.
Other dns servers usually use something between 10 and 30
seconds.

Avoid excessive nsec() and time() calls by having timems()
function that only uses nsec() and then updates global
nowms (millisecons) and now (seconds) variable.

After the end of readnet(), timems() needs to be called
anyway to update the query statistics so we can use that
as the new "now".