]> err.no Git - varnish/commitdiff
This is slightly experimental:
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 10 Mar 2008 21:21:15 +0000 (21:21 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 10 Mar 2008 21:21:15 +0000 (21:21 +0000)
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

index 18a48e775d159322e402beeadc8108e681bddd2e..79ba734632dec470a70b7db5713b6a487dab8433 100644 (file)
@@ -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;
 }