From 87acc2782fe49a8b57d19783f61ff8bc667db68d Mon Sep 17 00:00:00 2001 From: Aliaksey Kandratsenka Date: Sun, 8 Mar 2020 18:22:17 -0700 Subject: [PATCH] amputate span events history Nobody used it in years. Abseil tcmalloc had it amputated years ago. --- src/central_freelist.cc | 3 --- src/page_heap.cc | 8 -------- src/span.cc | 12 ------------ src/span.h | 14 -------------- 4 files changed, 37 deletions(-) diff --git a/src/central_freelist.cc b/src/central_freelist.cc index 01a7310..d064c2f 100644 --- a/src/central_freelist.cc +++ b/src/central_freelist.cc @@ -110,7 +110,6 @@ void CentralFreeList::ReleaseToSpans(void* object) { if (span->objects == NULL) { tcmalloc::DLL_Remove(span); tcmalloc::DLL_Prepend(&nonempty_, span); - Event(span, 'N', 0); } // The following check is expensive, so it is disabled by default @@ -129,7 +128,6 @@ void CentralFreeList::ReleaseToSpans(void* object) { counter_++; span->refcount--; if (span->refcount == 0) { - Event(span, '#', 0); counter_ -= ((span->length<ByteSizeForClass(span->sizeclass)); tcmalloc::DLL_Remove(span); @@ -305,7 +303,6 @@ int CentralFreeList::FetchFromOneSpans(int N, void **start, void **end) { // Move to empty list tcmalloc::DLL_Remove(span); tcmalloc::DLL_Prepend(&empty_, span); - Event(span, 'E', 0); } *start = span->objects; diff --git a/src/page_heap.cc b/src/page_heap.cc index 7dd5646..44ad654 100644 --- a/src/page_heap.cc +++ b/src/page_heap.cc @@ -221,12 +221,10 @@ Span* PageHeap::Split(Span* span, Length n) { ASSERT(n < span->length); ASSERT(span->location == Span::IN_USE); ASSERT(span->sizeclass == 0); - Event(span, 'T', n); const int extra = span->length - n; Span* leftover = NewSpan(span->start + n, extra); ASSERT(leftover->location == Span::IN_USE); - Event(leftover, 'U', extra); RecordSpan(leftover); pagemap_.set(span->start + n - 1, span); // Update map from pageid to span span->length = n; @@ -262,14 +260,12 @@ Span* PageHeap::Carve(Span* span, Length n) { const int old_location = span->location; RemoveFromFreeList(span); span->location = Span::IN_USE; - Event(span, 'A', n); const int extra = span->length - n; ASSERT(extra >= 0); if (extra > 0) { Span* leftover = NewSpan(span->start + n, extra); leftover->location = old_location; - Event(leftover, 'S', extra); RecordSpan(leftover); // The previous span of |leftover| was just splitted -- no need to @@ -309,7 +305,6 @@ void PageHeap::Delete(Span* span) { span->sizeclass = 0; span->sample = 0; span->location = Span::ON_NORMAL_FREELIST; - Event(span, 'D', span->length); MergeIntoFreeList(span); // Coalesces if possible IncrementalScavenge(n); ASSERT(stats_.unmapped_bytes+ stats_.committed_bytes==stats_.system_bytes); @@ -379,7 +374,6 @@ void PageHeap::MergeIntoFreeList(Span* span) { span->start -= len; span->length += len; pagemap_.set(span->start, span); - Event(span, 'L', len); } Span* next = CheckAndHandlePreMerge(span, GetDescriptor(p+n)); if (next != NULL) { @@ -389,7 +383,6 @@ void PageHeap::MergeIntoFreeList(Span* span) { DeleteSpan(next); span->length += len; pagemap_.set(span->start + span->length - 1, span); - Event(span, 'R', len); } PrependToFreeList(span); @@ -554,7 +547,6 @@ void PageHeap::RegisterSizeClass(Span* span, uint32 sc) { ASSERT(span->location == Span::IN_USE); ASSERT(GetDescriptor(span->start) == span); ASSERT(GetDescriptor(span->start+span->length-1) == span); - Event(span, 'C', sc); span->sizeclass = sc; for (Length i = 1; i < span->length-1; i++) { pagemap_.set(span->start+i, span); diff --git a/src/span.cc b/src/span.cc index 4d08964..eac43f4 100644 --- a/src/span.cc +++ b/src/span.cc @@ -42,23 +42,11 @@ namespace tcmalloc { -#ifdef SPAN_HISTORY -void Event(Span* span, char op, int v = 0) { - span->history[span->nexthistory] = op; - span->value[span->nexthistory] = v; - span->nexthistory++; - if (span->nexthistory == sizeof(span->history)) span->nexthistory = 0; -} -#endif - Span* NewSpan(PageID p, Length len) { Span* result = Static::span_allocator()->New(); memset(result, 0, sizeof(*result)); result->start = p; result->length = len; -#ifdef SPAN_HISTORY - result->nexthistory = 0; -#endif return result; } diff --git a/src/span.h b/src/span.h index ca3f710..7068893 100644 --- a/src/span.h +++ b/src/span.h @@ -93,24 +93,10 @@ struct Span { // Copies out and destroys iterator stored in span_iter_space. SpanSet::iterator ExtractSpanSetIterator(); -#undef SPAN_HISTORY -#ifdef SPAN_HISTORY - // For debugging, we can keep a log events per span - int nexthistory; - char history[64]; - int value[64]; -#endif - // What freelist the span is on: IN_USE if on none, or normal or returned enum { IN_USE, ON_NORMAL_FREELIST, ON_RETURNED_FREELIST }; }; -#ifdef SPAN_HISTORY -void Event(Span* span, char op, int v = 0); -#else -#define Event(s,o,v) ((void) 0) -#endif - inline SpanPtrWithLength::SpanPtrWithLength(Span* s) : span(s), length(s->length) {