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>
diff --git a/include/linux/memory_alloc.h b/include/linux/memory_alloc.h
index 88e64ce..e7049f8 100644
--- a/include/linux/memory_alloc.h
+++ b/include/linux/memory_alloc.h
@@ -23,6 +23,7 @@
unsigned long paddr;
unsigned long size;
unsigned long free;
+ unsigned int id;
};
struct alloc {
@@ -31,6 +32,7 @@
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 @@
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);