[4.1] c5c2f9f Introduce the parameter vsm_free_cooldown

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Thu Jun 16 16:12:11 CEST 2016


commit c5c2f9f29015b42f64f9b4154f7ca1165e00454e
Author: Pål Hermunn Johansen <hermunn at varnish-software.com>
Date:   Wed Jun 15 15:21:22 2016 +0200

    Introduce the parameter vsm_free_cooldown
    
    This new parameter specifies how long freed VSM memory is on the
    cooling list before it is actually freed.

diff --git a/bin/varnishd/common/common_vsm.c b/bin/varnishd/common/common_vsm.c
index 0dda841..cb440c9 100644
--- a/bin/varnishd/common/common_vsm.c
+++ b/bin/varnishd/common/common_vsm.c
@@ -41,11 +41,14 @@
 #include <unistd.h>
 
 #include "common.h"
+#include "common/params.h"
 
 #include "vsm_priv.h"
 #include "vmb.h"
 #include "vtim.h"
 
+extern volatile struct params * cache_param;
+
 /*--------------------------------------------------------------------*/
 
 struct vsm_range {
@@ -299,7 +302,7 @@ VSM_common_free(struct vsm_sc *sc, void *ptr)
 		vr2 = VTAILQ_NEXT(vr, list);
 		VTAILQ_REMOVE(&sc->r_used, vr, list);
 		VTAILQ_INSERT_TAIL(&sc->r_cooling, vr, list);
-		vr->cool = VTIM_real() + 60;	/* XXX: param ? */
+		vr->cool = VTIM_real() + cache_param->vsm_free_cooldown;
 		if (vr2 != NULL)
 			vr2->chunk->next = vr->chunk->next;
 		else
diff --git a/include/tbl/params.h b/include/tbl/params.h
index 42672d0..5c3f46b 100644
--- a/include/tbl/params.h
+++ b/include/tbl/params.h
@@ -1315,6 +1315,21 @@ PARAM(
 	/* func */	NULL
 )
 
+PARAM(
+	/* name */	vsm_free_cooldown,
+	/* typ */	timeout,
+	/* min */	"10.000",
+	/* max */	"600.000",
+	/* default */	"60.000",
+	/* units */	"seconds",
+	/* flags */	0,
+	/* s-text */
+	"How long VSM memory is kept warm after a deallocation "
+	"(granularity approximately 2 seconds).",
+	/* l-text */	"",
+	/* func */	NULL
+)
+
 #if 0
 PARAM(
 	/* name */	vcl_dir,



More information about the varnish-commit mailing list