You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/03/07 23:30:09 UTC

svn commit: r1575434 - /subversion/trunk/subversion/libsvn_subr/cache-membuffer.c

Author: stefan2
Date: Fri Mar  7 22:30:08 2014
New Revision: 1575434

URL: http://svn.apache.org/r1575434
Log:
Make it easier to remove unused high-priority entries from the membuffer
cache by reducing their priority every time they survive a cleanup
without having seen a recent hit.

* subversion/libsvn_subr/cache-membuffer.c
  (let_entry_age): Once the hit count reaches zero, aging eats away
                   the entry's priority.

Modified:
    subversion/trunk/subversion/libsvn_subr/cache-membuffer.c

Modified: subversion/trunk/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cache-membuffer.c?rev=1575434&r1=1575433&r2=1575434&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cache-membuffer.c Fri Mar  7 22:30:08 2014
@@ -1108,8 +1108,15 @@ let_entry_age(svn_membuffer_t *cache, en
 {
   apr_uint32_t hits_removed = (entry->hit_count + 1) >> 1;
 
-  cache->hit_count -= hits_removed;
-  entry->hit_count -= hits_removed;
+  if (hits_removed)
+    {
+      cache->hit_count -= hits_removed;
+      entry->hit_count -= hits_removed;
+    }
+  else
+    {
+      entry->priority /= 2;
+    }
 }
 
 /* Given the GROUP_INDEX that shall contain an entry with the hash key