You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/02/12 06:21:05 UTC
trafficserver git commit: TS-4197: Add memory debugging
Repository: trafficserver
Updated Branches:
refs/heads/master baf2d759c -> c8d165148
TS-4197: Add memory debugging
This closes #470
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c8d16514
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c8d16514
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c8d16514
Branch: refs/heads/master
Commit: c8d16514878885e87bf8d45b31742e56921a53ed
Parents: baf2d75
Author: Phil Sorber <so...@apache.org>
Authored: Thu Feb 11 21:58:29 2016 -0700
Committer: Phil Sorber <so...@apache.org>
Committed: Thu Feb 11 22:20:19 2016 -0700
----------------------------------------------------------------------
lib/ts/hugepages.cc | 9 +++++----
lib/ts/ink_queue.cc | 12 +++++++++---
2 files changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c8d16514/lib/ts/hugepages.cc
----------------------------------------------------------------------
diff --git a/lib/ts/hugepages.cc b/lib/ts/hugepages.cc
index 7763da0..76f74fd 100644
--- a/lib/ts/hugepages.cc
+++ b/lib/ts/hugepages.cc
@@ -68,14 +68,14 @@ ats_hugepage_init(int enabled)
hugepage_size = 0;
if (!enabled) {
- Debug(DEBUG_TAG, "hugepages not enabled");
+ Debug(DEBUG_TAG "_init", "hugepages not enabled");
return;
}
fp = fopen(MEMINFO_PATH, "r");
if (fp == NULL) {
- Debug(DEBUG_TAG, "Cannot open file %s", MEMINFO_PATH);
+ Debug(DEBUG_TAG "_init", "Cannot open file %s", MEMINFO_PATH);
return;
}
@@ -100,9 +100,9 @@ ats_hugepage_init(int enabled)
hugepage_enabled = true;
}
- Debug(DEBUG_TAG, "Hugepage size = %d", hugepage_size);
+ Debug(DEBUG_TAG "_init", "Hugepage size = %d", hugepage_size);
#else
- Debug(DEBUG_TAG, "MAP_HUGETLB not defined");
+ Debug(DEBUG_TAG "_init", "MAP_HUGETLB not defined");
#endif
}
@@ -122,6 +122,7 @@ ats_alloc_hugepage(size_t s)
return NULL;
}
+ Debug(DEBUG_TAG, "Request/Allocation (%zu/%zu) {%p}", s, size, mem);
return mem;
#else
(void)s;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c8d16514/lib/ts/ink_queue.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_queue.cc b/lib/ts/ink_queue.cc
index b1abb45..fb13d61 100644
--- a/lib/ts/ink_queue.cc
+++ b/lib/ts/ink_queue.cc
@@ -50,6 +50,9 @@
#include "ts/ink_assert.h"
#include "ts/ink_align.h"
#include "ts/hugepages.h"
+#include "ts/Diags.h"
+
+#define DEBUG_TAG "freelist"
inkcoreapi volatile int64_t fastalloc_mem_in_use = 0;
inkcoreapi volatile int64_t fastalloc_mem_total = 0;
@@ -135,16 +138,19 @@ ink_freelist_init(InkFreeList **fl, const char *name, uint32_t type_size, uint32
ink_assert(!(alignment & (alignment - 1)));
// It is never useful to have alignment requirement looser than a page size
// so clip it. This makes the item alignment checks in the actual allocator simpler.
- if (alignment > ats_pagesize())
- alignment = ats_pagesize();
f->alignment = alignment;
+ if (f->alignment > ats_pagesize())
+ f->alignment = ats_pagesize();
+ Debug(DEBUG_TAG "_init", "<%s> Alignment request/actual (%" PRIu32 "/%" PRIu32 ")", name, alignment, f->alignment);
// Make sure we align *all* the objects in the allocation, not just the first one
- f->type_size = INK_ALIGN(type_size, alignment);
+ f->type_size = INK_ALIGN(type_size, f->alignment);
+ Debug(DEBUG_TAG "_init", "<%s> Type Size request/actual (%" PRIu32 "/%" PRIu32 ")", name, type_size, f->type_size);
if (ats_hugepage_enabled()) {
f->chunk_size = INK_ALIGN(chunk_size * f->type_size, ats_hugepage_size()) / f->type_size;
} else {
f->chunk_size = INK_ALIGN(chunk_size * f->type_size, ats_pagesize()) / f->type_size;
}
+ Debug(DEBUG_TAG "_init", "<%s> Chunk Size request/actual (%" PRIu32 "/%" PRIu32 ")", name, chunk_size, f->chunk_size);
SET_FREELIST_POINTER_VERSION(f->head, FROM_PTR(0), 0);
*fl = f;