[6.0] 2963be64c Never allocate at offset zero in a cluster, this makes it faster for clients what the _index entry is about.
Martin Blix Grydeland
martin at varnish-software.com
Fri Oct 18 13:23:06 UTC 2019
commit 2963be64cf6c0179c48876377030d9b9b36dd8ff
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 328999e42..9fab01d7d 100644
--- a/bin/varnishd/common/common_vsmw.c
+++ b/bin/varnishd/common/common_vsmw.c
@@ -138,6 +138,9 @@ struct vsmw {
uint64_t nsubs;
};
+/* Allocations in clusters never start at offset zero */
+#define VSM_CLUSTER_OFFSET 16
+
/*--------------------------------------------------------------------*/
static void
@@ -311,7 +314,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