Commit abf653cd authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Argument polishing

parent b6633c0b
...@@ -632,7 +632,7 @@ void EXP_Insert(struct object *o); ...@@ -632,7 +632,7 @@ void EXP_Insert(struct object *o);
void EXP_Inject(struct objcore *oc, struct lru *lru, double when); void EXP_Inject(struct objcore *oc, struct lru *lru, double when);
void EXP_Init(void); void EXP_Init(void);
void EXP_Rearm(const struct object *o); void EXP_Rearm(const struct object *o);
void EXP_Touch(struct object *o, double tnow); int EXP_Touch(struct objcore *oc);
int EXP_NukeOne(const struct sess *sp, struct lru *lru); int EXP_NukeOne(const struct sess *sp, struct lru *lru);
/* cache_fetch.c */ /* cache_fetch.c */
......
...@@ -208,8 +208,9 @@ cnt_deliver(struct sess *sp) ...@@ -208,8 +208,9 @@ cnt_deliver(struct sess *sp)
sp->t_resp = TIM_real(); sp->t_resp = TIM_real();
if (sp->obj->objcore != NULL) { if (sp->obj->objcore != NULL) {
if ((sp->t_resp - sp->obj->last_lru) > params->lru_timeout) if ((sp->t_resp - sp->obj->last_lru) > params->lru_timeout &&
EXP_Touch(sp->obj, sp->t_resp); EXP_Touch(sp->obj->objcore))
sp->obj->last_lru = sp->t_resp;
sp->obj->last_use = sp->t_resp; /* XXX: locking ? */ sp->obj->last_use = sp->t_resp; /* XXX: locking ? */
} }
sp->wrk->resp = sp->wrk->http[2]; sp->wrk->resp = sp->wrk->http[2];
......
...@@ -156,14 +156,11 @@ EXP_Insert(struct object *o) ...@@ -156,14 +156,11 @@ EXP_Insert(struct object *o)
* This optimization obviously leaves the LRU list imperfectly sorted. * This optimization obviously leaves the LRU list imperfectly sorted.
*/ */
void int
EXP_Touch(struct object *o, double tnow) EXP_Touch(struct objcore *oc)
{ {
struct objcore *oc;
struct lru *lru; struct lru *lru;
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
oc = o->objcore;
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
/* /*
...@@ -174,7 +171,7 @@ EXP_Touch(struct object *o, double tnow) ...@@ -174,7 +171,7 @@ EXP_Touch(struct object *o, double tnow)
* the cleaner from doing its job. * the cleaner from doing its job.
*/ */
if (oc->flags & OC_F_LRUDONTMOVE) if (oc->flags & OC_F_LRUDONTMOVE)
return; return (0);
lru = oc_getlru(oc); lru = oc_getlru(oc);
CHECK_OBJ_NOTNULL(lru, LRU_MAGIC); CHECK_OBJ_NOTNULL(lru, LRU_MAGIC);
...@@ -186,16 +183,15 @@ EXP_Touch(struct object *o, double tnow) ...@@ -186,16 +183,15 @@ EXP_Touch(struct object *o, double tnow)
* reduce contention a fair bit * reduce contention a fair bit
*/ */
if (Lck_Trylock(&lru->mtx)) if (Lck_Trylock(&lru->mtx))
return; return (0);
if (oc->timer_idx != BINHEAP_NOIDX) { if (oc->timer_idx != BINHEAP_NOIDX) {
VTAILQ_REMOVE(&lru->lru_head, oc, lru_list); VTAILQ_REMOVE(&lru->lru_head, oc, lru_list);
VTAILQ_INSERT_TAIL(&lru->lru_head, oc, lru_list); VTAILQ_INSERT_TAIL(&lru->lru_head, oc, lru_list);
VSC_main->n_lru_moved++; VSC_main->n_lru_moved++;
o->last_lru = tnow;
} }
Lck_Unlock(&lru->mtx); Lck_Unlock(&lru->mtx);
return (1);
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment