ANDROID: vendor_hooks: add hooks for slab memory leak debugging

Add hooks and additional fields in vm_struct and track structs
to store and report additional information for slab memory leak
debugging.

Bug: 184928480
Bug: 395197442
Change-Id: I6897a6a98d4eaaea492673cefd4111a7ba741940
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Signed-off-by: wengle <wengle@oppo.com>
This commit is contained in:
Liujie Xie
2021-05-11 19:05:32 +08:00
committed by Carlos Llamas
parent 3404298ae0
commit 293d51412c
4 changed files with 12 additions and 0 deletions
+2
View File
@@ -413,3 +413,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_evict);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_vmscan_kswapd_done);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_reclaim_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_failure_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_save_vmalloc_stack);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_stack_hash);
+2
View File
@@ -11,6 +11,7 @@
#include <asm/page.h> /* pgprot_t */
#include <linux/rbtree.h>
#include <linux/overflow.h>
#include <linux/android_vendor.h>
#include <asm/vmalloc.h>
@@ -61,6 +62,7 @@ struct vm_struct {
unsigned int nr_pages;
phys_addr_t phys_addr;
const void *caller;
ANDROID_OEM_DATA(1);
};
struct vmap_area {
+6
View File
@@ -326,6 +326,12 @@ DECLARE_HOOK(android_vh_alloc_pages_failure_bypass,
TP_PROTO(gfp_t gfp_mask, int order, int alloc_flags,
int migratetype, struct page **page),
TP_ARGS(gfp_mask, order, alloc_flags, migratetype, page));
DECLARE_HOOK(android_vh_save_vmalloc_stack,
TP_PROTO(unsigned long flags, struct vm_struct *vm),
TP_ARGS(flags, vm));
DECLARE_HOOK(android_vh_show_stack_hash,
TP_PROTO(struct seq_file *m, struct vm_struct *v),
TP_ARGS(m, v));
DECLARE_HOOK(android_vh_save_track_hash,
TP_PROTO(bool alloc, struct track *p),
TP_ARGS(alloc, p));
+2
View File
@@ -1947,6 +1947,7 @@ static inline void setup_vmalloc_vm(struct vm_struct *vm,
vm->size = va_size(va);
vm->caller = caller;
va->vm = vm;
trace_android_vh_save_vmalloc_stack(flags, vm);
}
/*
@@ -5033,6 +5034,7 @@ static int vmalloc_info_show(struct seq_file *m, void *p)
seq_puts(m, " vpages");
show_numa_info(m, v);
trace_android_vh_show_stack_hash(m, v);
seq_putc(m, '\n');
}
spin_unlock(&vn->busy.lock);