Compare commits

...

10 Commits

Author SHA1 Message Date
Witold Kręcicki
4490087bd7 Experiment: arena-based mempool 2019-11-13 23:31:09 +01:00
Witold Kręcicki
6ee5c7350a Don't unroll the loop 2019-11-13 13:40:01 +01:00
Witold Kręcicki
e22e4da851 use trylock in badcache 2019-11-13 13:13:53 +01:00
Witold Kręcicki
f4d2bcfe83 Revert "Experiment: don't set netmgr thread affinity"
This reverts commit 663227a3cf.
2019-11-13 12:26:49 +01:00
Witold Kręcicki
663227a3cf Experiment: don't set netmgr thread affinity 2019-11-13 12:06:50 +01:00
Witold Kręcicki
69a5f0dd47 Revert "Make client->task pinned to the same CPU as calling netmgr task"
This reverts commit 5d2cc7979c.
2019-11-13 12:03:35 +01:00
Witold Kręcicki
afeb96aa29 More RES_DOMAIN_BUCKETS 2019-11-13 12:00:50 +01:00
Witold Kręcicki
f576d0dd0b Don't implicitly unpause a task 2019-11-13 11:26:34 +01:00
Witold Kręcicki
5d2cc7979c Make client->task pinned to the same CPU as calling netmgr task 2019-11-13 11:12:41 +01:00
Witold Kręcicki
09595c6669 Don't add SERVFAILs caused by quota to badcache 2019-11-13 10:52:13 +01:00
6 changed files with 42 additions and 55 deletions

View File

@@ -216,7 +216,9 @@ dns_badcache_find(dns_badcache_t *bc, const dns_name_t *name,
REQUIRE(name != NULL);
REQUIRE(now != NULL);
LOCK(&bc->lock);
if (isc_mutex_trylock(&bc->lock) != ISC_R_SUCCESS) {
return (false);
}
/*
* XXXMUKS: dns_name_equal() is expensive as it does a

View File

@@ -558,36 +558,6 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
else
count = count2;
/* Loop unrolled for performance */
while (ISC_LIKELY(count > 3)) {
chdiff = (int)maptolower[label1[0]] -
(int)maptolower[label2[0]];
if (chdiff != 0) {
*orderp = chdiff;
goto done;
}
chdiff = (int)maptolower[label1[1]] -
(int)maptolower[label2[1]];
if (chdiff != 0) {
*orderp = chdiff;
goto done;
}
chdiff = (int)maptolower[label1[2]] -
(int)maptolower[label2[2]];
if (chdiff != 0) {
*orderp = chdiff;
goto done;
}
chdiff = (int)maptolower[label1[3]] -
(int)maptolower[label2[3]];
if (chdiff != 0) {
*orderp = chdiff;
goto done;
}
count -= 4;
label1 += 4;
label2 += 4;
}
while (ISC_LIKELY(count-- > 0)) {
chdiff = (int)maptolower[*label1++] -
(int)maptolower[*label2++];

View File

@@ -172,7 +172,7 @@
/* Number of hash buckets for zone counters */
#ifndef RES_DOMAIN_BUCKETS
#define RES_DOMAIN_BUCKETS 523
#define RES_DOMAIN_BUCKETS 2047
#endif
#define RES_NOBUCKET 0xffffffff

View File

@@ -185,6 +185,7 @@ struct isc__mempool {
ISC_LINK(isc__mempool_t) link; /*%< next pool in this mem context */
/*%< optionally locked from here down */
element *items; /*%< low water item list */
element *fitems;
size_t size; /*%< size of each item on this pool */
unsigned int maxalloc; /*%< max number of items allowed */
unsigned int allocated; /*%< # of items currently given out */
@@ -1572,7 +1573,8 @@ isc_mempool_create(isc_mem_t *mctx0, size_t size, isc_mempool_t **mpctxp) {
mpctx->name[0] = 0;
#endif
mpctx->items = NULL;
mpctx->fitems = NULL;
*mpctxp = (isc_mempool_t *)mpctx;
MCTXLOCK(mctx);
@@ -1634,17 +1636,15 @@ isc_mempool_destroy(isc_mempool_t **mpctxp) {
* Return any items on the free list
*/
MCTXLOCK(mctx);
while (mpctx->items != NULL) {
INSIST(mpctx->freecount > 0);
mpctx->freecount--;
item = mpctx->items;
mpctx->items = item->next;
while (mpctx->fitems != NULL) {
item = mpctx->fitems;
mpctx->fitems = item->next;
if ((mctx->flags & ISC_MEMFLAG_INTERNAL) != 0) {
mem_putunlocked(mctx, item, mpctx->size);
mem_putunlocked(mctx, item, mpctx->size * (mpctx->fillcount + 1));
} else {
mem_putstats(mctx, item, mpctx->size);
mem_put(mctx, item, mpctx->size);
mem_putstats(mctx, item, mpctx->size * (mpctx->fillcount + 1));
mem_put(mctx, item, mpctx->size * (mpctx->fillcount + 1));
}
}
MCTXUNLOCK(mctx);
@@ -1707,16 +1707,19 @@ isc__mempool_get(isc_mempool_t *mpctx0 FLARG) {
* here and fill up our free list.
*/
MCTXLOCK(mctx);
for (i = 0; i < mpctx->fillcount; i++) {
if ((mctx->flags & ISC_MEMFLAG_INTERNAL) != 0) {
item = mem_getunlocked(mctx, mpctx->size);
} else {
item = mem_get(mctx, mpctx->size);
if (item != NULL)
mem_getstats(mctx, mpctx->size);
element *fitem;
if ((mctx->flags & ISC_MEMFLAG_INTERNAL) != 0) {
fitem = mem_getunlocked(mctx, (mpctx->fillcount+1) * mpctx->size);
} else {
fitem = mem_get(mctx, (mpctx->fillcount+1) * mpctx->size);
if (fitem != NULL) {
mem_getstats(mctx, mpctx->size);
}
if (ISC_UNLIKELY(item == NULL))
break;
}
fitem->next = mpctx->fitems;
mpctx->fitems = fitem;
for (i = 1; i < mpctx->fillcount+1; i++) {
item = (element*) (((char*) fitem) + i*mpctx->size);
item->next = mpctx->items;
mpctx->items = item;
mpctx->freecount++;
@@ -1783,7 +1786,7 @@ isc__mempool_put(isc_mempool_t *mpctx0, void *mem FLARG) {
/*
* If our free list is full, return this to the mctx directly.
*/
if (mpctx->freecount >= mpctx->freemax) {
/* if (mpctx->freecount >= mpctx->freemax) {
MCTXLOCK(mctx);
if ((mctx->flags & ISC_MEMFLAG_INTERNAL) != 0) {
mem_putunlocked(mctx, mem, mpctx->size);
@@ -1795,7 +1798,7 @@ isc__mempool_put(isc_mempool_t *mpctx0, void *mem FLARG) {
if (mpctx->lock != NULL)
UNLOCK(mpctx->lock);
return;
}
} */
/*
* Otherwise, attach it to our free list and bump the counter.

View File

@@ -1190,7 +1190,11 @@ dispatch(isc__taskmgr_t *manager, unsigned int threadid) {
finished = true;
task->state = task_state_done;
} else {
task->state = task_state_idle;
/* It might be paused */
if (task->state ==
task_state_running) {
task->state = task_state_idle;
}
}
done = true;
} else if (dispatch_count >= task->quantum) {
@@ -1205,8 +1209,14 @@ dispatch(isc__taskmgr_t *manager, unsigned int threadid) {
* so the minimum quantum is one.
*/
XTRACE("quantum");
task->state = task_state_ready;
requeue = true;
if (task->state == task_state_running) {
/*
* We requeue only if it's
* not paused.
*/
task->state = task_state_ready;
requeue = true;
}
done = true;
}
} while (!done);

View File

@@ -5819,6 +5819,8 @@ ns_query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname,
ns_client_killoldestquery(client);
}
if (result != ISC_R_SUCCESS) {
/* Don't add this to badcache */
client->attributes |= NS_CLIENTATTR_NOSETFC;
return (result);
}