[master] c5b9d70 Further steps in the separation of EXP and LRU

Poul-Henning Kamp phk at FreeBSD.org
Wed Feb 3 23:45:28 CET 2016


commit c5b9d70ba198954674817b2cff41118b8b3dfd1b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Feb 3 16:14:04 2016 +0000

    Further steps in the separation of EXP and LRU

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index b6961ae..b95255e 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -361,7 +361,6 @@ struct lru {
 #define LRU_MAGIC		0x3fec7bb0
 	VTAILQ_HEAD(,objcore)	lru_head;
 	struct lock		mtx;
-	unsigned		n_objcore;
 };
 
 /* Stored object -----------------------------------------------------
@@ -692,7 +691,7 @@ void EXP_Clr(struct exp *e);
 double EXP_Ttl(const struct req *, const struct exp*);
 double EXP_When(const struct exp *exp);
 void EXP_Insert(struct worker *wrk, struct objcore *oc);
-void EXP_Inject(struct worker *wrk, struct objcore *oc, struct lru *lru);
+void EXP_Inject(struct worker *wrk, struct objcore *oc);
 void EXP_Rearm(struct objcore *, double now, double ttl, double grace,
     double keep);
 void EXP_Poke(struct objcore *);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 2a6ebc8..7b5341d 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -174,22 +174,15 @@ EXP_Poke(struct objcore *oc)
  */
 
 void
-EXP_Inject(struct worker *wrk, struct objcore *oc, struct lru *lru)
+EXP_Inject(struct worker *wrk, struct objcore *oc)
 {
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
 
-	AZ(isnan(oc->last_lru));
 	AZ(oc->exp_flags & (OC_EF_INSERT | OC_EF_MOVE));
 	AZ(oc->flags & OC_F_DYING);
 	AZ(oc->flags & OC_F_BUSY);
-	CHECK_OBJ_NOTNULL(lru, LRU_MAGIC);
-
-	Lck_Lock(&lru->mtx);
-	lru->n_objcore++;
-	oc->last_lru = NAN;
-	Lck_Unlock(&lru->mtx);
 
 	oc->timer_when = EXP_When(&oc->exp);
 
@@ -207,25 +200,15 @@ EXP_Inject(struct worker *wrk, struct objcore *oc, struct lru *lru)
 void
 EXP_Insert(struct worker *wrk, struct objcore *oc)
 {
-	struct lru *lru;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
 	HSH_Ref(oc);
 
-	AZ(isnan(oc->last_lru));
 	AZ(oc->exp_flags & (OC_EF_INSERT | OC_EF_MOVE));
 	AZ(oc->flags & OC_F_DYING);
 	AN(oc->flags & OC_F_BUSY);
 
-	lru = ObjGetLRU(oc);
-	CHECK_OBJ_NOTNULL(lru, LRU_MAGIC);
-
-	Lck_Lock(&lru->mtx);
-	lru->n_objcore++;
-	oc->last_lru = NAN;
-	Lck_Unlock(&lru->mtx);
-
 	exp_event(wrk, oc, EXP_INSERT);
 	exp_mail_it(oc, OC_EF_INSERT | OC_EF_EXP | OC_EF_MOVE);
 }
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 24c2084..1d594d7 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -76,6 +76,7 @@ hsh_NewObjCore(struct worker *wrk, int boc)
 	AN(oc);
 	wrk->stats->n_objectcore++;
 	oc->flags |= OC_F_BUSY | OC_F_INCOMPLETE;
+	oc->last_lru = NAN;
 	if (boc) {
 		ALLOC_OBJ(oc->boc, BOC_MAGIC);
 		AN(oc->boc);
diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c
index fe0d889..3b125d1 100644
--- a/bin/varnishd/storage/storage_persistent_silo.c
+++ b/bin/varnishd/storage/storage_persistent_silo.c
@@ -169,7 +169,8 @@ smp_load_seg(struct worker *wrk, const struct smp_sc *sc,
 		HSH_Insert(wrk, so->hash, oc);
 		oc->exp = so->exp;
 		sg->nobj++;
-		EXP_Inject(wrk, oc, sg->lru);
+		oc->last_lru = NAN;
+		EXP_Inject(wrk, oc);
 	}
 	Pool_Sumstat(wrk);
 	sg->flags |= SMP_SEG_LOADED;



More information about the varnish-commit mailing list