[master] 29d940014 Never allocate at offset zero in a cluster, this makes it faster for clients what the _index entry is about.

Poul-Henning Kamp phk at FreeBSD.org
Tue Aug 13 11:10:10 UTC 2019


commit 29d940014dccab1cb820db1cdf3a907558f5b059
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Aug 13 07:38:51 2019 +0000

    Never allocate at offset zero in a cluster, this makes it faster
    for clients what the _index entry is about.

diff --git a/bin/varnishd/common/common_vsmw.c b/bin/varnishd/common/common_vsmw.c
index 9454c4e6a..ee69eea56 100644
--- a/bin/varnishd/common/common_vsmw.c
+++ b/bin/varnishd/common/common_vsmw.c
@@ -137,6 +137,9 @@ struct vsmw {
 	uint64_t			nsubs;
 };
 
+/* Allocations in clusters never start at offset zero */
+#define VSM_CLUSTER_OFFSET 16
+
 /*--------------------------------------------------------------------*/
 
 static void
@@ -307,7 +310,9 @@ VSMW_NewCluster(struct vsmw *vsmw, size_t len, const char *pfx)
 	struct vsmwseg *seg;
 
 	vsmw_do_lock();
-	vc = vsmw_newcluster(vsmw, len, pfx);
+	vc = vsmw_newcluster(vsmw, len + VSM_CLUSTER_OFFSET, pfx);
+	AN(vc);
+	vc->next += VSM_CLUSTER_OFFSET;
 
 	ALLOC_OBJ(seg, VSMWSEG_MAGIC);
 	AN(seg);


More information about the varnish-commit mailing list