[master] 353073c Make VSC->hcb_nolock a worker local counter for consistency, locking it would seriously miss the point.

Poul-Henning Kamp phk at varnish-cache.org
Mon Apr 23 10:00:42 CEST 2012


commit 353073cf26dc461fdc0e5f11e40fdebc34c0c763
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Apr 23 08:00:01 2012 +0000

    Make VSC->hcb_nolock a worker local counter for consistency, locking
    it would seriously miss the point.
    
    Spotted by:	scoof

diff --git a/bin/varnishd/hash/hash_critbit.c b/bin/varnishd/hash/hash_critbit.c
index 08be561..46f7f95 100644
--- a/bin/varnishd/hash/hash_critbit.c
+++ b/bin/varnishd/hash/hash_critbit.c
@@ -432,7 +432,7 @@ hcb_lookup(struct worker *wrk, const void *digest, struct objhead **noh)
 
 	/* First try in read-only mode without holding a lock */
 
-	VSC_C_main->hcb_nolock++;
+	wrk->stats.hcb_nolock++;
 	oh = hcb_insert(wrk, &hcb_root, digest, NULL);
 	if (oh != NULL) {
 		Lck_Lock(&oh->mtx);
diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h
index 2938d7a..bc79d5b 100644
--- a/include/tbl/vsc_f_main.h
+++ b/include/tbl/vsc_f_main.h
@@ -454,7 +454,7 @@ VSC_F(bans_dups,		uint64_t, 0, 'c',
 
 /**********************************************************************/
 
-VSC_F(hcb_nolock,		uint64_t, 0, 'a',
+VSC_F(hcb_nolock,		uint64_t, 1, 'a',
     "HCB Lookups without lock",
 	""
 )



More information about the varnish-commit mailing list