You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jw...@apache.org on 2003/12/10 04:22:32 UTC
cvs commit: httpd-2.0/modules/experimental cache_cache.c mod_mem_cache.c
jwoolley 2003/12/09 19:22:32
Modified: modules/experimental cache_cache.c mod_mem_cache.c
Log:
"Thanks for checking in the changes to mod_mem_cache.
I think there is a piece missing to that fixe;
the adjustment of the queue_clock value in cache_cache.c
(cache_insert()):
Sorry about not finding/pointing that out before asking you to check in
mod_mem_cache changes:
queue_clock is initialized to 0 when initializing the cache.
Based on the current conditional test (cache_cache.c, line 164):
----------------------------------------
priority = c->get_pri(ejected);
if (c->queue_clock < priority)
c->queue_clock = priority;
----------------------------------------
and the fact that the new get_pri() function return a negative value,
queue_clock will NEVER be adjusted with the ejected element priority.
This is a patch that should fix that problem:"
Submitted by: Jean-Jacques Clar
Generally glanced at by: Cliff Woolley (+1 on concept)
(better to get it in there than to
wait around for a year before I get
a chance to really test it)
Revision Changes Path
1.5 +1 -1 httpd-2.0/modules/experimental/cache_cache.c
Index: cache_cache.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/cache_cache.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -u -r1.4 -r1.5
--- cache_cache.c 5 Feb 2003 10:19:28 -0000 1.4
+++ cache_cache.c 10 Dec 2003 03:22:32 -0000 1.5
@@ -161,7 +161,7 @@
/* FIX: If ejected is NULL, we'll segfault here */
priority = c->get_pri(ejected);
- if (c->queue_clock < priority)
+ if (c->queue_clock > priority)
c->queue_clock = priority;
cache_hash_set(c->ht,
1.99 +3 -3 httpd-2.0/modules/experimental/mod_mem_cache.c
Index: mod_mem_cache.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_mem_cache.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -u -r1.98 -r1.99
--- mod_mem_cache.c 4 Dec 2003 00:16:13 -0000 1.98
+++ mod_mem_cache.c 10 Dec 2003 03:22:32 -0000 1.99
@@ -240,7 +240,7 @@
cache_object_t *obj = (cache_object_t *)a;
mem_cache_object_t *mobj = obj->vobj;
if (mobj->priority == 0)
- mobj->priority = -((long)(queue_clock + mobj->total_refs));
+ mobj->priority = queue_clock - mobj->total_refs;
/*
* a 'proper' LRU function would just be
@@ -255,8 +255,8 @@
mem_cache_object_t *mobj = obj->vobj;
if (mobj->priority == 0)
- mobj->priority = -(queue_clock +
- (long)(mobj->total_refs*1000 / mobj->m_len));
+ mobj->priority = queue_clock -
+ (long)(mobj->total_refs*1000 / mobj->m_len);
return mobj->priority;
}
Re: cvs commit: httpd-2.0/modules/experimental cache_cache.c
mod_mem_cache.c
Posted by Cliff Woolley <jw...@virginia.edu>.
On Tue, 10 Dec 2003 jwoolley@apache.org wrote:
> --- mod_mem_cache.c 4 Dec 2003 00:16:13 -0000 1.98
> +++ mod_mem_cache.c 10 Dec 2003 03:22:32 -0000 1.99
> @@ -240,7 +240,7 @@
> cache_object_t *obj = (cache_object_t *)a;
> mem_cache_object_t *mobj = obj->vobj;
> if (mobj->priority == 0)
> - mobj->priority = -((long)(queue_clock + mobj->total_refs));
> + mobj->priority = queue_clock - mobj->total_refs;
The only thing I don't understand is why this went from:
- queue_clock - mobj->total_refs
to:
queue_clock - mobj->total_refs
When the other case negated the whole statement. Is this intentional or
did you forget to account for the - in this case being distributed across
the ()'s?
Just checking,
Cliff