lib: Add debugfs file for tracking memory allocations

Add caller information to memory allocation calls and
create /sys/kernel/debug/mempool/map to show the current set of
allocations across all memory pools.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
Jordan Crouse
2011-05-26 10:27:47 -06:00
committed by Bryan Huntsman
parent e96f66dd6b
commit 8c78b13c97
3 changed files with 113 additions and 8 deletions

View File

@@ -23,6 +23,7 @@ struct mem_pool {
unsigned long paddr;
unsigned long size;
unsigned long free;
unsigned int id;
};
struct alloc {
@@ -31,6 +32,7 @@ struct alloc {
unsigned long paddr;
struct mem_pool *mpool;
unsigned long len;
void *caller;
};
struct mem_pool *initialize_memory_pool(unsigned long start,
@@ -39,6 +41,9 @@ struct mem_pool *initialize_memory_pool(unsigned long start,
void *allocate_contiguous_memory(unsigned long size,
int mem_type, unsigned long align, int cached);
unsigned long _allocate_contiguous_memory_nomap(unsigned long size,
int mem_type, unsigned long align, void *caller);
unsigned long allocate_contiguous_memory_nomap(unsigned long size,
int mem_type, unsigned long align);