/[Apache-SVN]
ViewVC logotype

Revision 1567996


Jump to revision: Previous Next
Author: stefan2
Date: Thu Feb 13 18:24:17 2014 UTC (10 years, 2 months ago)
Changed paths: 1
Log Message:
In the membuffer cache code, we update hit counters without further
synchronization as they are mere hints.  However, that can cause
64 bit underflows in the global hit counters which will make all
entry hit counters appear to be very small in comparison, i.e.
entries get evicted sooner than they should.

We fix this by simply switching to signed global counters which
compare nicely to unsigned values of less precision. This allows
us to keep the lock-free racy code without introducing a bias
(e.g. by saturating at 0 upon underflow).

Once at it, fix the local <-> global hit counter inconsistency
that occurs when the entry hit counter exceeds 4G - which might
happen for certain root objects.

* subversion/libsvn_subr/cache-membuffer.c
  (svn_membuffer_t): Switch to signed counters as those work
                     nicely with our comparison / eviction logic
                     even if we underflow to negative values.
  (increment_hit_counters): New utility function handling the
                            potential 32 bit counter overflow.
  (membuffer_cache_get_internal,
   membuffer_cache_has_key_internal,
   membuffer_cache_get_partial_internal,
   membuffer_cache_set_partial_internal): Call the new utility.

Found by: vitalif{_AT_}yourcmc.ru

Changed paths

Path Details
Directorysubversion/trunk/subversion/libsvn_subr/cache-membuffer.c modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26