r2590 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Mar 10 22:21:15 CET 2008


Author: phk
Date: 2008-03-10 22:21:15 +0100 (Mon, 10 Mar 2008)
New Revision: 2590

Modified:
   trunk/varnish-cache/bin/varnishd/shmlog.c
Log:
This is slightly experimental:

Reduce SHM mutex contention further, by only holding lock over
reservation of space, and do the copying from workthread buffer
to shm buffer efter we let go of the mutex.


Modified: trunk/varnish-cache/bin/varnishd/shmlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/shmlog.c	2008-03-10 08:22:31 UTC (rev 2589)
+++ trunk/varnish-cache/bin/varnishd/shmlog.c	2008-03-10 21:21:15 UTC (rev 2590)
@@ -185,13 +185,13 @@
 	if (loghead->ptr + l + 1 >= loghead->size)
 		vsl_wrap();
 	p = logstart + loghead->ptr;
-	memcpy(p + 1, w->wlb + 1, l - 1);
 	p[l] = SLT_ENDMARKER;
 	loghead->ptr += l;
 	assert(loghead->ptr < loghead->size);
+	UNLOCKSHM(&vsl_mtx);
+	memcpy(p + 1, w->wlb + 1, l - 1);
 	/* XXX: memory barrier here */
 	p[0] = w->wlb[0];
-	UNLOCKSHM(&vsl_mtx);
 	w->wlp = w->wlb;
 	w->wlr = 0;
 }




More information about the varnish-commit mailing list