r4860 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Thu May 27 12:48:01 CEST 2010


Author: phk
Date: 2010-05-27 12:48:01 +0200 (Thu, 27 May 2010)
New Revision: 4860

Modified:
   trunk/varnish-cache/bin/varnishd/flint.lnt
   trunk/varnish-cache/bin/varnishd/hash_critbit.c
Log:
Also cool off objheaders



Modified: trunk/varnish-cache/bin/varnishd/flint.lnt
===================================================================
--- trunk/varnish-cache/bin/varnishd/flint.lnt	2010-05-26 09:27:11 UTC (rev 4859)
+++ trunk/varnish-cache/bin/varnishd/flint.lnt	2010-05-27 10:48:01 UTC (rev 4860)
@@ -157,6 +157,7 @@
 -emacro((826), VTAILQ_PREV) // Suspicious pointer-to-pointer conversion (area too small)
 -emacro((826), VTAILQ_LAST) // Suspicious pointer-to-pointer conversion (area too small)
 -emacro(506, VTAILQ_FOREACH_SAFE) // constant value boolean
+-emacro(506, VSTAILQ_FOREACH_SAFE) // constant value boolean
 
 -esym(765, vcc_ProcAction) // could be made static
 -esym(759, vcc_ProcAction) // could be moved to module

Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_critbit.c	2010-05-26 09:27:11 UTC (rev 4859)
+++ trunk/varnish-cache/bin/varnishd/hash_critbit.c	2010-05-27 10:48:01 UTC (rev 4860)
@@ -109,8 +109,10 @@
 
 static struct hcb_root	hcb_root;
 
-static VSTAILQ_HEAD(, hcb_y)	cool = VSTAILQ_HEAD_INITIALIZER(cool);
-static VSTAILQ_HEAD(, hcb_y)	dead = VSTAILQ_HEAD_INITIALIZER(dead);
+static VSTAILQ_HEAD(, hcb_y)	cool_y = VSTAILQ_HEAD_INITIALIZER(cool_y);
+static VSTAILQ_HEAD(, hcb_y)	dead_y = VSTAILQ_HEAD_INITIALIZER(dead_y);
+static VTAILQ_HEAD(, objhead)	cool_h = VTAILQ_HEAD_INITIALIZER(cool_h);
+static VTAILQ_HEAD(, objhead)	dead_h = VTAILQ_HEAD_INITIALIZER(dead_h);
 
 /**********************************************************************
  * Pointer accessor functions
@@ -290,7 +292,7 @@
 		assert(s < 2);
 		if (y->leaf[s] == hcb_r_node(oh)) {
 			*p = y->leaf[1 - s];
-			VSTAILQ_INSERT_TAIL(&cool, y, list);
+			VSTAILQ_INSERT_TAIL(&cool_y, y, list);
 			return;
 		}
 		p = &y->leaf[s];
@@ -348,6 +350,7 @@
 {
 	struct hcb_y *y, *y2;
 	struct worker ww;
+	struct objhead *oh, *oh2;
 
 	memset(&ww, 0, sizeof ww);
 	ww.magic = WORKER_MAGIC;
@@ -355,12 +358,17 @@
 	THR_SetName("hcb_cleaner");
 	(void)priv;
 	while (1) {
-		VSTAILQ_FOREACH_SAFE(y, &dead, list, y2) {
-			VSTAILQ_REMOVE_HEAD(&dead, list);
+		VSTAILQ_FOREACH_SAFE(y, &dead_y, list, y2) {
+			VSTAILQ_REMOVE_HEAD(&dead_y, list);
 			FREE_OBJ(y);
 		}
+		VTAILQ_FOREACH_SAFE(oh, &dead_h, hoh_list, oh2) {
+			VTAILQ_REMOVE(&dead_h, oh, hoh_list);
+			HSH_DeleteObjHead(&ww, oh);
+		}
 		Lck_Lock(&hcb_mtx);
-		VSTAILQ_CONCAT(&dead, &cool);
+		VSTAILQ_CONCAT(&dead_y, &cool_y);
+		VTAILQ_CONCAT(&dead_h, &cool_h, hoh_list);
 		Lck_Unlock(&hcb_mtx);
 		WRK_SumStat(&ww);
 		TIM_sleep(params->critbit_cooloff);
@@ -397,10 +405,10 @@
 	if (oh->refcnt == 0) {
 		Lck_Lock(&hcb_mtx);
 		hcb_delete(&hcb_root, oh);
+		VTAILQ_INSERT_TAIL(&cool_h, oh, hoh_list);
 		Lck_Unlock(&hcb_mtx);
 		assert(VTAILQ_EMPTY(&oh->objcs));
 		assert(VTAILQ_EMPTY(&oh->waitinglist));
-		r = 0;
 	}
 	Lck_Unlock(&oh->mtx);
 #ifdef PHK




More information about the varnish-commit mailing list