Compare commits

..

3 Commits

Author SHA1 Message Date
Witold Kręcicki
0d6c4ce64a TEST: use jemalloc 2019-05-16 11:33:07 +02:00
Witold Kręcicki
a6b12b31fe TEST: use malloc/free directly, no accounting 2019-05-16 11:28:36 +02:00
Witold Kręcicki
5ac49fcb9d TEST: disable tracklines 2019-05-16 11:11:58 +02:00
6 changed files with 42 additions and 18 deletions

View File

@@ -9690,7 +9690,7 @@ get_matching_view(isc_netaddr_t *srcaddr, isc_netaddr_t *destaddr,
!(view->matchrecursiveonly &&
(message->flags & DNS_MESSAGEFLAG_RD) == 0))
{
*viewp = view; // dns_view_attach(view, viewp);
dns_view_attach(view, viewp);
return (ISC_R_SUCCESS);
}
}

View File

@@ -47,7 +47,7 @@ struct dns_zt {
struct zt_load_params *loadparams;
/* Locked by lock. */
bool flush;
isc_refcount_t references;
uint32_t references;
unsigned int loads_pending;
dns_rbt_t *table;
};
@@ -93,7 +93,7 @@ dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **ztp) {
zt->mctx = NULL;
isc_mem_attach(mctx, &zt->mctx);
isc_refcount_init(&zt->references, 1);
zt->references = 1;
zt->flush = false;
zt->rdclass = rdclass;
zt->magic = ZTMAGIC;
@@ -209,8 +209,14 @@ dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp) {
REQUIRE(VALID_ZT(zt));
REQUIRE(ztp != NULL && *ztp == NULL);
isc_refcount_increment(&zt->references);
RWLOCK(&zt->rwlock, isc_rwlocktype_write);
INSIST(zt->references > 0);
zt->references++;
INSIST(zt->references != 0);
RWUNLOCK(&zt->rwlock, isc_rwlocktype_write);
*ztp = zt;
}
@@ -238,9 +244,20 @@ zt_flushanddetach(dns_zt_t **ztp, bool need_flush) {
REQUIRE(ztp != NULL && VALID_ZT(*ztp));
zt = *ztp;
if (isc_refcount_decrement(&zt->references) == 1) {
RWLOCK(&zt->rwlock, isc_rwlocktype_write);
INSIST(zt->references > 0);
zt->references--;
if (zt->references == 0)
destroy = true;
if (need_flush)
zt->flush = true;
RWUNLOCK(&zt->rwlock, isc_rwlocktype_write);
if (destroy)
zt_destroy(zt);
}
*ztp = NULL;
}
@@ -323,13 +340,15 @@ asyncload(dns_zone_t *zone, void *zt_) {
isc_result_t result;
struct dns_zt *zt = (dns_zt_t*) zt_;
REQUIRE(zone != NULL);
isc_refcount_increment(&zt->references);
INSIST(zt->references > 0);
zt->references++;
zt->loads_pending++;
result = dns_zone_asyncload(zone, zt->loadparams->newonly, *zt->loadparams->dl, zt);
if (result != ISC_R_SUCCESS) {
isc_refcount_decrement(&zt->references);
zt->references--;
zt->loads_pending--;
INSIST(zt->references > 0);
}
return (ISC_R_SUCCESS);
}
@@ -529,7 +548,9 @@ doneloading(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task) {
RWLOCK(&zt->rwlock, isc_rwlocktype_write);
INSIST(zt->loads_pending != 0);
if (isc_refcount_decrement(&zt->references) == 1)
INSIST(zt->references != 0);
zt->references--;
if (zt->references == 0)
destroy = true;
zt->loads_pending--;
if (zt->loads_pending == 0) {

View File

@@ -38,7 +38,7 @@ typedef void (*isc_memfree_t)(void *, void *);
* allocation and freeing by file and line number.
*/
#ifndef ISC_MEM_TRACKLINES
#define ISC_MEM_TRACKLINES 1
#define ISC_MEM_TRACKLINES 0
#endif
/*%

View File

@@ -18,6 +18,7 @@
#include <stdlib.h>
#include <stddef.h>
#include <limits.h>
#include <jemalloc/jemalloc.h>
#include <isc/bind9.h>
#include <isc/hash.h>
@@ -468,6 +469,8 @@ more_frags(isc__mem_t *ctx, size_t new_size) {
static inline void *
mem_getunlocked(isc__mem_t *ctx, size_t size) {
return (malloc(size));
size_t new_size = quantize(size);
void *ret;
@@ -545,6 +548,8 @@ check_overrun(void *mem, size_t size, size_t new_size) {
/* coverity[+free : arg-1] */
static inline void
mem_putunlocked(isc__mem_t *ctx, void *mem, size_t size) {
free(mem);
return;
size_t new_size = quantize(size);
if (new_size >= ctx->max_size) {

View File

@@ -462,10 +462,8 @@ exit_check(ns_client_t *client) {
* Keep the view attached until any outstanding updates complete.
*/
if (client->nupdates == 0 &&
client->newstate == NS_CLIENTSTATE_FREED && client->view != NULL) {
client->view = NULL;
// dns_view_detach(&client->view);
}
client->newstate == NS_CLIENTSTATE_FREED && client->view != NULL)
dns_view_detach(&client->view);
if (client->state == NS_CLIENTSTATE_WORKING ||
client->state == NS_CLIENTSTATE_RECURSING)
@@ -895,8 +893,7 @@ ns_client_endrequest(ns_client_t *client) {
dns_adb_flush(client->view->adb);
}
#endif
// dns_view_detach(&client->view);
client->view = NULL;
dns_view_detach(&client->view);
}
if (client->opt != NULL) {
INSIST(dns_rdataset_isassociated(client->opt));

View File

@@ -4973,7 +4973,7 @@ qctx_init(ns_client_t *client, dns_fetchevent_t *event,
/* Set this first so CCTRACE will work */
qctx->client = client;
qctx->view = client->view;
dns_view_attach(client->view, &qctx->view);
CCTRACE(ISC_LOG_DEBUG(3), "qctx_init");
@@ -5049,6 +5049,7 @@ static void
qctx_destroy(query_ctx_t *qctx) {
CALL_HOOK_NORETURN(NS_QUERY_QCTX_DESTROYED, qctx);
dns_view_detach(&qctx->view);
if (qctx->detach_client) {
ns_client_detach(&qctx->client);
}