[master] c81973fb8 hash: Skip the unbusy ceremony for private objects
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Aug 27 15:23:05 UTC 2025
commit c81973fb8f470c614003dd3a8b18da3821e68bf3
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Mon Jan 22 17:17:04 2024 +0100
hash: Skip the unbusy ceremony for private objects
This reduces a great deal of spurious activity on the private_oh waiting
list and removes unncessary conditionals when dealing with cacheable (or
at least searchable) objects.
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 0c6c8d654..5d133a88f 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -907,24 +907,27 @@ HSH_Unbusy(struct worker *wrk, struct objcore *oc)
oh = oc->objhead;
CHECK_OBJ(oh, OBJHEAD_MAGIC);
- INIT_OBJ(&rush, RUSH_MAGIC);
AN(oc->stobj->stevedore);
AN(oc->flags & OC_F_BUSY);
assert(oh->refcnt > 0);
assert(oc->refcnt > 0);
- if (!(oc->flags & OC_F_PRIVATE)) {
- BAN_NewObjCore(oc);
- AN(oc->ban);
+ if (oc->flags & OC_F_PRIVATE) {
+ oc->flags &= ~OC_F_BUSY;
+ return;
}
+ INIT_OBJ(&rush, RUSH_MAGIC);
+
+ BAN_NewObjCore(oc);
+ AN(oc->ban);
+
/* XXX: pretouch neighbors on oh->objcs to prevent page-on under mtx */
Lck_Lock(&oh->mtx);
assert(oh->refcnt > 0);
assert(oc->refcnt > 0);
- if (!(oc->flags & OC_F_PRIVATE))
- EXP_RefNewObjcore(oc); /* Takes a ref for expiry */
+ EXP_RefNewObjcore(oc); /* Takes a ref for expiry */
/* XXX: strictly speaking, we should sort in Date: order. */
VTAILQ_REMOVE(&oh->objcs, oc, hsh_list);
VTAILQ_INSERT_HEAD(&oh->objcs, oc, hsh_list);
@@ -934,8 +937,7 @@ HSH_Unbusy(struct worker *wrk, struct objcore *oc)
hsh_rush1(wrk, oh, &rush, HSH_RUSH_POLICY);
}
Lck_Unlock(&oh->mtx);
- EXP_Insert(wrk, oc); /* Does nothing unless EXP_RefNewObjcore was
- * called */
+ EXP_Insert(wrk, oc);
hsh_rush2(wrk, &rush);
}
More information about the varnish-commit
mailing list