Commit 3c161283 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Partially revert previous optimization: it wasn't.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1985 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent db48355a
......@@ -221,21 +221,24 @@ wrk_thread(void *priv)
CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
assert(!isnan(w->used));
LOCK(&tmtx);
/* Process overflow requests, if any */
w->wrq = TAILQ_FIRST(&overflow);
if (w->wrq != NULL) {
VSL_stats->n_wrk_queue--;
TAILQ_REMOVE(&overflow, w->wrq, list);
} else {
LOCK(&tmtx);
/* Process overflow requests, if any */
w->wrq = TAILQ_FIRST(&overflow);
if (w->wrq != NULL) {
VSL_stats->n_wrk_queue--;
TAILQ_REMOVE(&overflow, w->wrq, list);
}
UNLOCK(&tmtx);
}
if (w->wrq == NULL) {
LOCK(&qp->mtx);
TAILQ_INSERT_HEAD(&qp->idle, w, list);
}
UNLOCK(&qp->mtx);
if (w->wrq == NULL)
UNLOCK(&qp->mtx);
assert(1 == read(w->pipe[0], &c, 1));
}
if (w->wrq == NULL)
break;
wrk_do_one(w);
......
......@@ -121,13 +121,14 @@ hcl_start(void)
static struct objhead *
hcl_lookup(struct sess *sp, struct objhead *noh)
{
struct objhead *roh;
struct hcl_entry *he, *he2;
struct hcl_hd *hp;
unsigned u1, digest, r;
unsigned u, v;
int i;
CHECK_OBJ_NOTNULL(noh, OBJHEAD_MAGIC);
CHECK_OBJ_ORNULL(noh, OBJHEAD_MAGIC);
digest = ~0U;
for (u = 0; u < sp->ihashptr; u += 2) {
......@@ -158,11 +159,15 @@ hcl_lookup(struct sess *sp, struct objhead *noh)
if (i > 0)
break;
he->refcnt++;
noh = he->oh;
roh = he->oh;
UNLOCK(&hp->mtx);
if (he2 != NULL)
free(he2);
return (noh);
if (noh->hash != NULL) {
free(noh->hash);
noh->hash = NULL;
}
return (roh);
}
if (noh == NULL) {
UNLOCK(&hp->mtx);
......@@ -189,6 +194,7 @@ hcl_lookup(struct sess *sp, struct objhead *noh)
he2->head = hp;
noh->hashpriv = he2;
AZ(noh->hash);
noh->hash = malloc(sp->lhashptr);
XXXAN(noh->hash);
noh->hashlen = sp->lhashptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment