r4857 - in trunk/varnish-cache: bin/varnishd include
phk at varnish-cache.org
phk at varnish-cache.org
Tue May 25 12:47:21 CEST 2010
Author: phk
Date: 2010-05-25 12:47:20 +0200 (Tue, 25 May 2010)
New Revision: 4857
Modified:
trunk/varnish-cache/bin/varnishd/hash_critbit.c
trunk/varnish-cache/include/stat_field.h
Log:
Add a counter so we know how many objhdr's are on the cooling list.
Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_critbit.c 2010-05-25 06:59:10 UTC (rev 4856)
+++ trunk/varnish-cache/bin/varnishd/hash_critbit.c 2010-05-25 10:47:20 UTC (rev 4857)
@@ -367,6 +367,7 @@
continue;
if (++oh->digest[0] > params->critbit_cooloff) {
VTAILQ_REMOVE(&laylow, oh, coollist);
+ VSL_stats->critbit_cooler--;
break;
}
}
@@ -415,6 +416,7 @@
assert(VTAILQ_EMPTY(&oh->waitinglist));
oh->digest[0] = 0;
VTAILQ_INSERT_TAIL(&laylow, oh, coollist);
+ VSL_stats->critbit_cooler++;
Lck_Unlock(&hcb_mtx);
}
Lck_Unlock(&oh->mtx);
@@ -428,7 +430,7 @@
hcb_lookup(const struct sess *sp, struct objhead *noh)
{
struct objhead *oh;
- volatile unsigned u;
+ unsigned u;
unsigned with_lock;
(void)sp;
@@ -439,11 +441,11 @@
Lck_Lock(&hcb_mtx);
VSL_stats->hcb_lock++;
assert(noh->refcnt == 1);
- oh = hcb_insert(&hcb_root, noh, 1);
+ oh = hcb_insert(&hcb_root, noh, 1);
Lck_Unlock(&hcb_mtx);
} else {
VSL_stats->hcb_nolock++;
- oh = hcb_insert(&hcb_root, noh, 0);
+ oh = hcb_insert(&hcb_root, noh, 0);
}
if (oh != NULL && oh == noh) {
@@ -468,8 +470,12 @@
* under us, so fall through and try with the lock held.
*/
u = oh->refcnt;
- if (u > 0)
+ if (u > 0) {
oh->refcnt++;
+ } else {
+ assert(!with_lock);
+ with_lock = 1;
+ }
Lck_Unlock(&oh->mtx);
if (u > 0)
return (oh);
Modified: trunk/varnish-cache/include/stat_field.h
===================================================================
--- trunk/varnish-cache/include/stat_field.h 2010-05-25 06:59:10 UTC (rev 4856)
+++ trunk/varnish-cache/include/stat_field.h 2010-05-25 10:47:20 UTC (rev 4857)
@@ -153,6 +153,8 @@
MAC_STAT(client_drop_late, uint64_t, 0, 'a', "Connection dropped late")
MAC_STAT(uptime, uint64_t, 0, 'a', "Client uptime")
+MAC_STAT(critbit_cooler, uint64_t, 0, 'i', "Objhdr's on cool list")
+
#ifdef __MAC_STAT
#undef MAC_STAT
#undef __MAC_STAT
More information about the varnish-commit
mailing list