Commit 9ed99f61 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move the worker vcl cache to the private part

parent e3a6652c
......@@ -237,8 +237,6 @@ struct worker {
pthread_cond_t cond;
struct vcl *vcl;
struct ws aws[1];
unsigned cur_method;
......
......@@ -445,8 +445,8 @@ vca_accept_task(struct worker *wrk, void *arg)
VTIM_sleep(.1);
/* Dont hold on to (possibly) discarded VCLs */
if (wrk->vcl != NULL)
VCL_Rel(&wrk->vcl);
if (wrk->wpriv->vcl != NULL)
VCL_Rel(&wrk->wpriv->vcl);
while (!ps->pool->die) {
INIT_OBJ(&wa, WRK_ACCEPT_MAGIC);
......
......@@ -1097,9 +1097,9 @@ CNT_Embark(struct worker *wrk, struct req *req)
req->vfc->wrk = req->wrk = wrk;
wrk->vsl = req->vsl;
if (req->req_step == R_STP_TRANSPORT && req->vcl == NULL) {
VCL_Refresh(&wrk->vcl);
req->vcl = wrk->vcl;
wrk->vcl = NULL;
VCL_Refresh(&wrk->wpriv->vcl);
req->vcl = wrk->wpriv->vcl;
wrk->wpriv->vcl = NULL;
VSLb(req->vsl, SLT_VCL_use, "%s", VCL_Name(req->vcl));
}
......
......@@ -81,6 +81,7 @@ struct worker_priv {
struct objcore *nobjcore;
void *nhashpriv;
struct vxid_pool vxid_pool[1];
struct vcl *vcl;
};
/*--------------------------------------------------------------------
......@@ -480,7 +481,7 @@ void VCL_VRT_Init(void);
const char *VCL_Return_Name(unsigned);
const char *VCL_Method_Name(unsigned);
void VCL_Refresh(struct vcl **);
void VCL_Recache(struct worker *, struct vcl **);
void VCL_Recache(const struct worker *, struct vcl **);
void VCL_Ref(struct vcl *);
void VCL_Rel(struct vcl **);
VCL_BACKEND VCL_DefaultDirector(const struct vcl *);
......
......@@ -91,20 +91,20 @@ VCL_Refresh(struct vcl **vcc)
}
void
VCL_Recache(struct worker *wrk, struct vcl **vclp)
VCL_Recache(const struct worker *wrk, struct vcl **vclp)
{
AN(wrk);
AN(vclp);
CHECK_OBJ_NOTNULL(*vclp, VCL_MAGIC);
if (*vclp != vcl_active || wrk->vcl == vcl_active) {
if (*vclp != vcl_active || wrk->wpriv->vcl == vcl_active) {
VCL_Rel(vclp);
return;
}
if (wrk->vcl != NULL)
VCL_Rel(&wrk->vcl);
wrk->vcl = *vclp;
if (wrk->wpriv->vcl != NULL)
VCL_Rel(&wrk->wpriv->vcl);
wrk->wpriv->vcl = *vclp;
*vclp = NULL;
}
......
......@@ -155,8 +155,8 @@ WRK_Thread(struct pool *qp, size_t stacksize, unsigned thread_workspace)
AZ(w->pool);
VSL(SLT_WorkThread, 0, "%p end", w);
if (w->vcl != NULL)
VCL_Rel(&w->vcl);
if (w->wpriv->vcl != NULL)
VCL_Rel(&w->wpriv->vcl);
AZ(pthread_cond_destroy(&w->cond));
HSH_Cleanup(w);
Pool_Sumstat(w);
......@@ -433,7 +433,7 @@ Pool_Work_Thread(struct pool *pp, struct worker *wrk)
* so that we'll wake up and get a
* chance to push stats. */
tmo = now + 1.;
else if (wrk->vcl == NULL)
else if (wrk->wpriv->vcl == NULL)
tmo = 0;
else if (DO_DEBUG(DBG_VTC_MODE))
tmo = now + 1.;
......@@ -468,8 +468,8 @@ Pool_Work_Thread(struct pool *pp, struct worker *wrk)
// Presumably ETIMEDOUT but we do not
// assert this because pthread condvars
// are not airtight.
if (wrk->vcl)
VCL_Rel(&wrk->vcl);
if (wrk->wpriv->vcl)
VCL_Rel(&wrk->wpriv->vcl);
now = VTIM_real();
}
} while (tp == NULL);
......@@ -483,8 +483,8 @@ Pool_Work_Thread(struct pool *pp, struct worker *wrk)
memset(wrk->task, 0, sizeof wrk->task);
assert(wrk->pool == pp);
tp->func(wrk, tp->priv);
if (DO_DEBUG(DBG_VCLREL) && wrk->vcl != NULL)
VCL_Rel(&wrk->vcl);
if (DO_DEBUG(DBG_VCLREL) && wrk->wpriv->vcl != NULL)
VCL_Rel(&wrk->wpriv->vcl);
tpx = *wrk->task;
tp = &tpx;
} while (tp->func != NULL);
......
......@@ -347,8 +347,8 @@ h2_new_session(struct worker *wrk, void *arg)
sp = req->sp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
if (wrk->vcl)
VCL_Rel(&wrk->vcl);
if (wrk->wpriv->vcl)
VCL_Rel(&wrk->wpriv->vcl);
assert(req->transport == &H2_transport);
......
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