From: phk Date: Mon, 10 Mar 2008 21:21:15 +0000 (+0000) Subject: This is slightly experimental: X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e1ce1d39533722b36310aeefd4c60bbfbce2161;p=varnish 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. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2590 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/shmlog.c b/varnish-cache/bin/varnishd/shmlog.c index 18a48e77..79ba7346 100644 --- a/varnish-cache/bin/varnishd/shmlog.c +++ b/varnish-cache/bin/varnishd/shmlog.c @@ -185,13 +185,13 @@ WSL_Flush(struct worker *w, int overflow) 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; }