Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: third_party/tcmalloc/chromium/src/central_freelist.h

Issue 9667026: Revert 126020 - Experiment for updating the tcmalloc chromium branch to r144 (gperftools 2.0). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/tcmalloc/chromium/src/central_freelist.h
===================================================================
--- third_party/tcmalloc/chromium/src/central_freelist.h (revision 126022)
+++ third_party/tcmalloc/chromium/src/central_freelist.h (working copy)
@@ -48,11 +48,6 @@
// Data kept per size-class in central cache.
class CentralFreeList {
public:
- // A CentralFreeList may be used before its constructor runs.
- // So we prevent lock_'s constructor from doing anything to the
- // lock_ state.
- CentralFreeList() : lock_(base::LINKER_INITIALIZED) { }
-
void Init(size_t cl);
// These methods all do internal locking.
@@ -73,12 +68,6 @@
// Returns the number of free objects in the transfer cache.
int tc_length();
- // Returns the memory overhead (internal fragmentation) attributable
- // to the freelist. This is memory lost when the size of elements
- // in a freelist doesn't exactly divide the page-size (an 8192-byte
- // page full of 5-byte objects would have 2 bytes memory overhead).
- size_t OverheadBytes();
-
private:
// TransferCache is used to cache transfers of
// sizemap.num_objects_to_move(size_class) back and forth between
@@ -88,16 +77,16 @@
void *tail; // Tail of chain of objects.
};
- // A central cache freelist can have anywhere from 0 to kMaxNumTransferEntries
- // slots to put link list chains into.
+ // A central cache freelist can have anywhere from 0 to kNumTransferEntries
+ // slots to put link list chains into. To keep memory usage bounded the total
+ // number of TCEntries across size classes is fixed. Currently each size
+ // class is initially given one TCEntry which also means that the maximum any
+ // one class can have is kNumClasses.
#ifdef TCMALLOC_SMALL_BUT_SLOW
// For the small memory model, the transfer cache is not used.
- static const int kMaxNumTransferEntries = 0;
+ static const int kNumTransferEntries = 0;
#else
- // Starting point for the the maximum number of entries in the transfer cache.
- // This actual maximum for a given size class may be lower than this
- // maximum value.
- static const int kMaxNumTransferEntries = 64;
+ static const int kNumTransferEntries = kNumClasses;
#endif
// REQUIRES: lock_ is held
@@ -156,15 +145,12 @@
size_t size_class_; // My size class
Span empty_; // Dummy header for list of empty spans
Span nonempty_; // Dummy header for list of non-empty spans
- size_t num_spans_; // Number of spans in empty_ plus nonempty_
size_t counter_; // Number of free objects in cache entry
- // Here we reserve space for TCEntry cache slots. Space is preallocated
- // for the largest possible number of entries than any one size class may
- // accumulate. Not all size classes are allowed to accumulate
- // kMaxNumTransferEntries, so there is some wasted space for those size
- // classes.
- TCEntry tc_slots_[kMaxNumTransferEntries];
+ // Here we reserve space for TCEntry cache slots. Since one size class can
+ // end up getting all the TCEntries quota in the system we just preallocate
+ // sufficient number of entries here.
+ TCEntry tc_slots_[kNumTransferEntries];
// Number of currently used cached entries in tc_slots_. This variable is
// updated under a lock but can be read without one.
@@ -173,8 +159,6 @@
// adaptive value that is increased if there is lots of traffic
// on a given size class.
int32_t cache_size_;
- // Maximum size of the cache for a given size class.
- int32_t max_cache_size_;
};
// Pads each CentralCache object to multiple of 64 bytes. Since some
« no previous file with comments | « third_party/tcmalloc/chromium/src/base/vdso_support.cc ('k') | third_party/tcmalloc/chromium/src/central_freelist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698