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 2012/09/26 13:22:09 UTC

svn commit: r1390407 - /subversion/branches/10Gb/subversion/libsvn_subr/cache-membuffer.c

Author: stefan2
Date: Wed Sep 26 11:22:09 2012
New Revision: 1390407

URL: http://svn.apache.org/viewvc?rev=1390407&view=rev
Log:
On the 10Gb branch: fix a membuffer cache effectiveness issue.
The lower part of the group index was always identical to the
cache segment index. I.e. most groups would not be used at all
causing the used ones to overflow quickly.

* subversion/libsvn_subr/cache-membuffer.c
  (entry_t): fix typo in docstring
  (get_group_index): select group independently of segment 

Modified:
    subversion/branches/10Gb/subversion/libsvn_subr/cache-membuffer.c

Modified: subversion/branches/10Gb/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/10Gb/subversion/libsvn_subr/cache-membuffer.c?rev=1390407&r1=1390406&r2=1390407&view=diff
==============================================================================
--- subversion/branches/10Gb/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/10Gb/subversion/libsvn_subr/cache-membuffer.c Wed Sep 26 11:22:09 2012
@@ -320,7 +320,7 @@ typedef struct entry_t
    */
   entry_key_t key;
 
-  /* If NO_OFFSET, the entry is not in used. Otherwise, it is the offset
+  /* If NO_OFFSET, the entry is not in use. Otherwise, it is the offset
    * of the cached item's serialized data within the data buffer.
    */
   apr_uint64_t offset;
@@ -738,9 +738,11 @@ static apr_uint32_t
 get_group_index(svn_membuffer_t **cache,
                 entry_key_t key)
 {
-  /* select the cache segment to use */
-  *cache = &(*cache)[key[0] & ((*cache)->segment_count -1)];
-  return key[0] % (*cache)->group_count;
+  svn_membuffer_t *segment0 = *cache;
+  
+  /* select the cache segment to use. they have all the same group_count */
+  *cache = &segment0[key[0] & (segment0->segment_count -1)];
+  return key[1] % segment0->group_count;
 }
 
 /* Reduce the hit count of ENTRY and update the accumunated hit info