From 5e1ce1d39533722b36310aeefd4c60bbfbce2161 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 10 Mar 2008 21:21:15 +0000 Subject: [PATCH] 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 --- varnish-cache/bin/varnishd/shmlog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } -- 2.39.5