Commit d46391fa authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Don't recache req->vcl in wrk unless it will speed things up later.

parent 2fe1e1aa
......@@ -217,12 +217,8 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req)
AZ(req->esi_level);
AZ(req->privs->magic);
if (req->vcl != NULL) {
if (wrk->vcl != NULL)
VCL_Rel(&wrk->vcl);
wrk->vcl = req->vcl;
req->vcl = NULL;
}
if (req->vcl != NULL)
VCL_Recache(wrk, &req->vcl);
/* Charge and log byte counters */
if (req->vsl->wid) {
......
......@@ -382,6 +382,7 @@ void VCL_Panic(struct vsb *, const struct vcl *);
void VCL_Poll(void);
void VCL_Ref(struct vcl *);
void VCL_Refresh(struct vcl **);
void VCL_Recache(struct worker *, struct vcl **);
void VCL_Rel(struct vcl **);
void VCL_TaskEnter(const struct vcl *, struct vrt_privs *);
void VCL_TaskLeave(const struct vcl *, struct vrt_privs *);
......
......@@ -76,17 +76,36 @@ VCL_Method_Name(unsigned m)
void
VCL_Refresh(struct vcl **vcc)
{
while (vcl_active == NULL)
(void)usleep(100000);
if (*vcc == vcl_active)
return;
if (*vcc != NULL)
VCL_Rel(vcc); /* XXX: optimize locking */
while (vcl_active == NULL)
(void)usleep(100000);
vcl_get(vcc, NULL);
}
void
VCL_Recache(struct worker *wrk, struct vcl **vclp)
{
AN(wrk);
AN(vclp);
CHECK_OBJ_NOTNULL(*vclp, VCL_MAGIC);
if (*vclp != vcl_active || wrk->vcl == vcl_active) {
VCL_Rel(vclp);
return;
}
if (wrk->vcl != NULL)
VCL_Rel(&wrk->vcl);
wrk->vcl = *vclp;
*vclp = NULL;
}
void
VCL_Ref(struct vcl *vcl)
{
......
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