Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hash: Transfer waiting list ownership to the objcore #3992

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bin/varnishd/cache/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ struct objcore {
VTAILQ_ENTRY(objcore) lru_list;
VTAILQ_ENTRY(objcore) ban_list;
VSTAILQ_ENTRY(objcore) exp_list;
VTAILQ_HEAD(, req) waitinglist;
struct ban *ban;
};

Expand Down Expand Up @@ -490,8 +491,8 @@ struct req {

struct objcore *body_oc;

/* The busy objhead we sleep on */
struct objhead *hash_objhead;
/* The busy objcore we sleep on */
struct objcore *hash_oc;

/* Built Vary string == workspace reservation */
uint8_t *vary_b;
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishd/cache/cache_ban_lurker.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt,
if (i)
ObjSendEvent(wrk, oc, OEV_BANCHG);
}
(void)HSH_DerefObjCore(wrk, &oc, 0);
(void)HSH_DerefObjCore(wrk, &oc);
}
}

Expand Down
6 changes: 2 additions & 4 deletions bin/varnishd/cache/cache_busyobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,8 @@ VBO_ReleaseBusyObj(struct worker *wrk, struct busyobj **pbo)
if (WS_Overflowed(bo->ws))
wrk->stats->ws_backend_overflow++;

if (bo->fetch_objcore != NULL) {
(void)HSH_DerefObjCore(wrk, &bo->fetch_objcore,
HSH_RUSH_POLICY);
}
if (bo->fetch_objcore != NULL)
(void)HSH_DerefObjCore(wrk, &bo->fetch_objcore);

VRT_Assign_Backend(&bo->director_req, NULL);
VRT_Assign_Backend(&bo->director_resp, NULL);
Expand Down
6 changes: 3 additions & 3 deletions bin/varnishd/cache/cache_expire.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ EXP_Insert(struct worker *wrk, struct objcore *oc)
ObjSendEvent(wrk, oc, OEV_EXPIRE);
tmpoc = oc;
assert(oc->refcnt >= 2); /* Silence coverity */
(void)HSH_DerefObjCore(wrk, &oc, 0);
(void)HSH_DerefObjCore(wrk, &oc);
AZ(oc);
assert(tmpoc->refcnt >= 1); /* Silence coverity */
}
Expand Down Expand Up @@ -280,7 +280,7 @@ exp_inbox(struct exp_priv *ep, struct objcore *oc, unsigned flags)
assert(oc->refcnt > 0);
AZ(oc->exp_flags);
ObjSendEvent(ep->wrk, oc, OEV_EXPIRE);
(void)HSH_DerefObjCore(ep->wrk, &oc, 0);
(void)HSH_DerefObjCore(ep->wrk, &oc);
return;
}

Expand Down Expand Up @@ -357,7 +357,7 @@ exp_expire(struct exp_priv *ep, vtim_real now)
VSLb(&ep->vsl, SLT_ExpKill, "EXP_Expired xid=%ju t=%.0f",
VXID(ObjGetXID(ep->wrk, oc)), EXP_Ttl(NULL, oc) - now);
ObjSendEvent(ep->wrk, oc, OEV_EXPIRE);
(void)HSH_DerefObjCore(ep->wrk, &oc, 0);
(void)HSH_DerefObjCore(ep->wrk, &oc);
}
return (0);
}
Expand Down
13 changes: 6 additions & 7 deletions bin/varnishd/cache/cache_fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "cache_varnishd.h"
#include "cache_filter.h"
#include "cache_objhead.h"
#include "hash/hash_slinger.h"
#include "storage/storage.h"
#include "vcl.h"
#include "vtim.h"
Expand Down Expand Up @@ -923,7 +922,7 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)

stale = bo->stale_oc;
oc->t_origin = now;
if (!VTAILQ_EMPTY(&oc->objhead->waitinglist)) {
if (!VTAILQ_EMPTY(&oc->waitinglist)) {
/*
* If there is a waitinglist, it means that there is no
* grace-able object, so cache the error return for a
Expand Down Expand Up @@ -1059,7 +1058,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
CHECK_OBJ_NOTNULL(bo->stale_oc, OBJCORE_MAGIC);
/* We don't want the oc/stevedore ops in fetching thread */
if (!ObjCheckFlag(wrk, bo->stale_oc, OF_IMSCAND))
(void)HSH_DerefObjCore(wrk, &bo->stale_oc, 0);
(void)HSH_DerefObjCore(wrk, &bo->stale_oc);
}
#endif

Expand All @@ -1086,7 +1085,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
http_Teardown(bo->beresp);
// can not make assumptions about the number of references here #3434
if (bo->bereq_body != NULL)
(void) HSH_DerefObjCore(bo->wrk, &bo->bereq_body, 0);
(void) HSH_DerefObjCore(bo->wrk, &bo->bereq_body);

if (oc->boc->state == BOS_FINISHED) {
AZ(oc->flags & OC_F_FAILED);
Expand All @@ -1096,7 +1095,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
// AZ(oc->boc); // XXX

if (bo->stale_oc != NULL)
(void)HSH_DerefObjCore(wrk, &bo->stale_oc, 0);
(void)HSH_DerefObjCore(wrk, &bo->stale_oc);

wrk->vsl = NULL;
HSH_DerefBoc(wrk, oc);
Expand Down Expand Up @@ -1185,7 +1184,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
wrk->stats->bgfetch_no_thread++;
(void)vbf_stp_fail(req->wrk, bo);
if (bo->stale_oc != NULL)
(void)HSH_DerefObjCore(wrk, &bo->stale_oc, 0);
(void)HSH_DerefObjCore(wrk, &bo->stale_oc);
HSH_DerefBoc(wrk, oc);
SES_Rel(bo->sp);
THR_SetBusyobj(NULL);
Expand All @@ -1210,5 +1209,5 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
assert(oc->boc == boc);
HSH_DerefBoc(wrk, oc);
if (mode == VBF_BACKGROUND)
(void)HSH_DerefObjCore(wrk, &oc, HSH_RUSH_POLICY);
(void)HSH_DerefObjCore(wrk, &oc);
}
Loading