Compare commits

...
Author SHA1 Message Date
Aydın Mercan 068bfa6a21 more temporary probing 2024-06-10 13:10:59 +03:00
Aydın Mercan 617a9ee373 unbarrier 2024-06-08 20:50:58 +03:00
Aydın Mercan c1a945cfdc temporary trace: 2024-06-08 18:58:16 +03:00
Evan Hunt 206e67b008 remove unnecessary argument to find_deepest_zonecut()
a minor bit of code refactoring - the 'node' argument wasn't
being used; it was just being treated as a local variable.
2024-06-07 17:24:46 -07:00
Evan Hunt c7a236e49e experiment: improve locking around decref()
instead of always calling decref() with a node lock, we now only
acquire the lock if the node needs to be cleaned or deleted.
2024-06-07 17:24:46 -07:00
Evan Hunt 19674c5c6e experiment: make header->trust atomic 2024-06-07 17:24:46 -07:00
Evan Hunt c6d5e8bc86 experiment: increase QP chunk size 2024-06-07 17:24:46 -07:00
Evan Hunt 90f29d61d2 minor findnode optimization
when searching for a node so that we can delete an rdataset,
it is not necessary to set the 'create' flag. if the node doesn't
exist yet, we wouldn't be able delete anything from it.
2024-06-07 17:24:45 -07:00
Evan Hunt a7e6c06ef7 in findnode, use a read transaction when possible
when findnode() is called with the 'create' flag set, instead of
automatically opening a write transaction, we will now try to look up
the name with a read transaction, and only open a write transaction if
that failed.
2024-06-07 17:24:45 -07:00
Evan Hunt 0ea634a5db reduce node locking
some calls to bindrdataset were node-locked; this is no longer necessary.
2024-06-07 17:24:45 -07:00
Evan Hunt 893571a19d access node attributes atomically
in the qpcnode struct, the .delegating, .nsec, and .dirty
members are now atomic, enabling us to avoid acquiring the
node lock when those are the only things we need to check.

also, renamed the check_zonecut() function to the more
correctly descriptive has_dname().
2024-06-07 17:24:45 -07:00
Ondřej SurýandEvan Hunt 6f8a75e6e1 compact the cache database less often
to speed up the cache, compact the database only when nodes
have been added or removed.
2024-06-07 17:24:45 -07:00
Ondřej SurýandEvan Hunt 929fb51612 add an isc_loop_rcu_barrier() for memory cleanup to finish
when adding data to the cache while over memory limits, add an
RCU barrier to ensure that memory is cleaned right away.
2024-06-07 17:24:20 -07:00
Ondřej SurýandEvan Hunt fb39babdff Add a function to call rcu_barrier once per loop
isc_loop_rcu_barrier() sets a flag so that rcu_barrier() will be
called at the end of the current loop tick. This allows us to minimize
time spent synchronizing between threads.
2024-06-07 17:24:19 -07:00
Evan Hunt b649786423 use dns_qpmulti instead of dns_qp in the cache
replace the single-threaded dns_qp objects in the qpcache
database with dns_qpmulti and eliminate the tree lock.
2024-06-07 17:24:19 -07:00
13 changed files with 412 additions and 566 deletions
+2 -2
View File
@@ -342,8 +342,8 @@ libdns_la_LIBADD += $(LMDB_LIBS)
endif
if !HAVE_SYSTEMTAP
DTRACE_DEPS = libdns_la-xfrin.lo
DTRACE_OBJS = .libs/libdns_la-xfrin.$(OBJEXT)
DTRACE_DEPS = libdns_la-xfrin.lo libdns_la-qpcache.lo
DTRACE_OBJS = .libs/libdns_la-xfrin.$(OBJEXT) .libs/libdns_la-qpcache.$(OBJEXT)
endif
include $(top_srcdir)/Makefile.dtrace
+1 -1
View File
@@ -75,7 +75,7 @@ struct dns_slabheader {
dns_ttl_t ttl;
dns_typepair_t type;
atomic_uint_least16_t attributes;
dns_trust_t trust;
atomic_uint_fast16_t trust;
unsigned int heap_index;
/*%<
+3
View File
@@ -27,4 +27,7 @@ provider libdns {
probe xfrin_recv_try_axfr(void *, char *, int);
probe xfrin_sent(void *, char *, int);
probe xfrin_start(void *, char *);
probe qpcache_addrdataset_done(void *, uint32_t, bool overmem);
probe qpcache_addrdataset_start(void *, uint32_t);
};
+1 -1
View File
@@ -1058,7 +1058,7 @@ dns_qpmulti_memusage(dns_qpmulti_t *multi) {
dns_qp_memusage_t memusage = dns_qp_memusage(qp);
if (qp->transaction_mode == QP_UPDATE) {
if (qp->transaction_mode == QP_UPDATE && qp->usage != NULL) {
memusage.bytes -= QP_CHUNK_BYTES;
memusage.bytes += qp->usage[qp->bump].used *
sizeof(dns_qpnode_t);
+1 -1
View File
@@ -141,7 +141,7 @@ enum {
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
#define QP_CHUNK_LOG 7
#else
#define QP_CHUNK_LOG 10
#define QP_CHUNK_LOG 12
#endif
STATIC_ASSERT(6 <= QP_CHUNK_LOG && QP_CHUNK_LOG <= 20,
+368 -554
View File
File diff suppressed because it is too large Load Diff
-2
View File
@@ -1407,9 +1407,7 @@ static void
rdataset_settrust(dns_rdataset_t *rdataset, dns_trust_t trust) {
dns_slabheader_t *header = dns_slabheader_fromrdataset(rdataset);
dns_db_locknode(header->db, header->node, isc_rwlocktype_write);
header->trust = rdataset->trust = trust;
dns_db_unlocknode(header->db, header->node, isc_rwlocktype_write);
}
static void
+1 -2
View File
@@ -5190,7 +5190,7 @@ validated(void *arg) {
result = ISC_R_NOTFOUND;
if (val->rdataset != NULL) {
result = dns_db_findnode(fctx->cache, val->name,
true, &node);
false, &node);
}
if (result == ISC_R_SUCCESS) {
(void)dns_db_deleterdataset(fctx->cache, node,
@@ -5815,7 +5815,6 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_message_t *message,
/*
* Find or create the cache node.
*/
node = NULL;
result = dns_db_findnode(fctx->cache, name, true, &node);
if (result != ISC_R_SUCCESS) {
return (result);
+2 -2
View File
@@ -260,8 +260,8 @@ libisc_la_LIBADD += \
endif HAVE_LIBXML2
if !HAVE_SYSTEMTAP
DTRACE_DEPS = libisc_la-rwlock.lo libisc_la-job.lo
DTRACE_OBJS = .libs/libisc_la-rwlock.$(OBJEXT) .libs/libisc_la-job.$(OBJEXT)
DTRACE_DEPS = libisc_la-rwlock.lo libisc_la-job.lo libisc_la-loop.lo
DTRACE_OBJS = .libs/libisc_la-rwlock.$(OBJEXT) .libs/libisc_la-job.$(OBJEXT) .libs/libisc_la-loop.$(OBJEXT)
endif
include $(top_srcdir)/Makefile.dtrace
+10
View File
@@ -225,4 +225,14 @@ isc_loop_shuttingdown(isc_loop_t *loop);
*
* \li 'loop' is a valid loop and the loop tid matches the current tid.
*/
void
isc_loop_rcu_barrier(isc_loop_t *loop);
/*%<
* Triggers an rcu_barrier() call at the end of the current loop tick.
*
* Requires:
*
* \li 'loop' is a valid loop and the loop tid matches the current tid.
*/
ISC_LANG_ENDDECLS
+18 -1
View File
@@ -41,6 +41,7 @@
#include "async_p.h"
#include "job_p.h"
#include "loop_p.h"
#include "probes.h"
/**
* Private
@@ -236,7 +237,9 @@ loop_init(isc_loop_t *loop, isc_loopmgr_t *loopmgr, uint32_t tid) {
static void
quiescent_cb(uv_prepare_t *handle) {
UNUSED(handle);
isc_loop_t *loop = uv_handle_get_data(handle);
LIBISC_LOOP_QUIESCENT_CB_START(loop, loop->rcu_barrier);
#if defined(RCU_QSBR)
/* safe memory reclamation */
@@ -247,6 +250,12 @@ quiescent_cb(uv_prepare_t *handle) {
#else
INSIST(!rcu_read_ongoing());
#endif
if (loop->rcu_barrier) {
rcu_barrier();
}
LIBISC_LOOP_QUIESCENT_CB_DONE(loop, loop->rcu_barrier);
}
static void
@@ -624,3 +633,11 @@ isc_loop_shuttingdown(isc_loop_t *loop) {
return (loop->shuttingdown);
}
void
isc_loop_rcu_barrier(isc_loop_t *loop) {
REQUIRE(VALID_LOOP(loop));
REQUIRE(loop->tid == isc_tid());
loop->rcu_barrier = true;
}
+2
View File
@@ -76,6 +76,8 @@ struct isc_loop {
/* safe memory reclamation */
uv_prepare_t quiescent;
bool rcu_barrier;
};
/*
+3
View File
@@ -27,4 +27,7 @@ provider libisc {
probe rwlock_wrlock_acq(void *);
probe rwlock_wrlock_req(void *);
probe rwlock_wrunlock(void *);
probe loop_quiescent_cb_done(void *, bool);
probe loop_quiescent_cb_start(void *, bool);
};