]> err.no Git - varnish/commitdiff
Reduce syscall footprint of expiry and hangman
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 11 Sep 2006 09:14:29 +0000 (09:14 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 11 Sep 2006 09:14:29 +0000 (09:14 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@956 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_expire.c

index 33f0a5e6a1852fcf7bdff4c3ddf505de4137243a..bccf56420cc535ae91c6e35faa1ad229620d4b52 100644 (file)
@@ -59,8 +59,8 @@ exp_hangman(void *arg)
 
        (void)arg;
 
+       t = time(NULL); 
        while (1) {
-               t = time(NULL); 
                LOCK(&exp_mtx);
                TAILQ_FOREACH(o, &exp_deathrow, deathrow) {
                        CHECK_OBJ(o, OBJECT_MAGIC);
@@ -79,6 +79,7 @@ exp_hangman(void *arg)
                if (o == NULL) {
                        UNLOCK(&exp_mtx);
                        AZ(sleep(1));
+                       t = time(NULL); 
                        continue;
                }
                TAILQ_REMOVE(&exp_deathrow, o, deathrow);
@@ -111,15 +112,19 @@ exp_prefetch(void *arg)
 
        sp = SES_New(NULL, 0);
        XXXAN(sp);
+       sp->vcl = VCL_Get();
+       t = time(NULL);
        while (1) {
-               t = time(NULL);
                LOCK(&exp_mtx);
                o = binheap_root(exp_heap);
                if (o != NULL)
                        CHECK_OBJ(o, OBJECT_MAGIC);
                if (o == NULL || o->ttl > t + expearly) {
                        UNLOCK(&exp_mtx);
+                       VCL_Rel(sp->vcl);
                        AZ(sleep(1));
+                       sp->vcl = VCL_Get();
+                       t = time(NULL);
                        continue;
                }
                binheap_delete(exp_heap, o->heap_idx);
@@ -132,10 +137,8 @@ exp_prefetch(void *arg)
                UNLOCK(&exp_mtx);
                VSL(SLT_ExpPick, 0, "%u", o->xid);
 
-               sp->vcl = VCL_Get();
                sp->obj = o;
                VCL_timeout_method(sp);
-               VCL_Rel(sp->vcl);
 
                if (sp->handling == VCL_RET_DISCARD) {
                        LOCK(&exp_mtx);