diff options
| author | Doug Gilbert <dgilbert@us.ibm.com> | 2011-09-26 13:36:33 -0500 |
|---|---|---|
| committer | Douglas R. Gilbert <dgilbert@us.ibm.com> | 2011-10-25 11:16:20 -0500 |
| commit | 5ab488739184f2b2649193e3f9da695ee334d04f (patch) | |
| tree | 3d47e74b8dd290598527988adccff0ff57c72dc0 /src/usr/trace | |
| parent | d127ad9d985ffd7a42dba798bee66654242c4fe6 (diff) | |
| download | blackbird-hostboot-5ab488739184f2b2649193e3f9da695ee334d04f.tar.gz blackbird-hostboot-5ab488739184f2b2649193e3f9da695ee334d04f.zip | |
new HEAP manager to reduce fragmentation
Change-Id: Ibe725a43e6366d9113ec99df1cc6aafa7bbb770e
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/431
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com>
Diffstat (limited to 'src/usr/trace')
| -rw-r--r-- | src/usr/trace/trace.C | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/usr/trace/trace.C b/src/usr/trace/trace.C index 8a8456bb7..f14978854 100644 --- a/src/usr/trace/trace.C +++ b/src/usr/trace/trace.C @@ -35,6 +35,7 @@ /******************************************************************************/ #include <trace/interface.H> #include <stdarg.h> +#include <stdlib.h> #include <arch/ppc.H> #include <kernel/console.H> #include <kernel/pagemgr.H> @@ -66,9 +67,6 @@ const uint32_t COMP_NAME_SIZE = 16; // NULL terminated string // Initial implementation is to allocate a fixed 2KB buffer to each // component on request. // NOTE: any change to this value will require change to Trace::initBuffer() -// since currently malloc() does not work for large allocations/fragmentations -// and we are using PageManager::allocatePage() to allocate space for two -// buffers at a time. Once malloc() works, we can remove this constraint. const uint64_t TRAC_DEFAULT_BUFFER_SIZE = 0x0800; //2KB // NOTE: This constant should only be changed to an even number for now. @@ -189,17 +187,14 @@ void Trace::initBuffer(trace_desc_t **o_td, const char* i_comp, { //printk("Trace::initBuffer - allocate memory\n"); - // Allocate memory for two buffers. - // Once malloc() works, we can allocate memory for one - // one buffer at a time. - l_td = static_cast<char *>(PageManager::allocatePage()); - + // Allocate memory + // TODO can't handle i_size yet - everything is coded + // around TRAC_DEFAULT_BUFFER_SIZE + l_td = static_cast<char *>(malloc(TRAC_DEFAULT_BUFFER_SIZE)); + g_desc_array[i].td_entry = reinterpret_cast<trace_desc_t *>(l_td); - g_desc_array[i+1].td_entry = - reinterpret_cast<trace_desc_t *>( - l_td + TRAC_DEFAULT_BUFFER_SIZE); } // Initialize the buffer header @@ -235,12 +230,8 @@ void Trace::initBuffer(trace_desc_t **o_td, const char* i_comp, //printk("Trace::initBuffer - allocate memory\n"); // Allocate memory for buffer - l_td = static_cast<char *>(PageManager::allocatePage()); + l_td = static_cast<char *>(malloc(TRAC_DEFAULT_BUFFER_SIZE)); - // Throw away the last 2KB for now to keep code simple - // until we decide to add support for variable-sized - // buffers. Also, once we change to use malloc(), - // we won't have this problem. g_desc_array[i].td_entry = reinterpret_cast<trace_desc_t *>(l_td); } |

