ANDROID: vendor_hooks: Add hooks for memory when debug
Add vendors hooks for recording memory used Vendor modules allocate and manages the memory itself. These memories might not be included in kernel memory statistics. Also, detailed references and vendor-specific information are managed only inside modules. When various problems such as memory leaks occurs, these information should be showed in real-time. Bug: 182443489 Bug: 234407991 Bug: 277799025 Bug: 341802931 Change-Id: I976de52fa514805e42fabb9fcfb23b399990bcc8 Signed-off-by: Liujie Xie <xieliujie@oppo.com> Signed-off-by: Hyesoo Yu <hyesoo.yu@samsung.com> (cherry picked from commit dccd72bc17d87eff07a25a297755c3852df06a16)
This commit is contained in:
@@ -175,6 +175,11 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_aes_expandkey);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_aes_encrypt);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_aes_decrypt);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_should_fault_around);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_meminfo_proc_show);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_mm);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_mem);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_print_slabinfo_header);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cache_show);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_fixup_sea);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_free);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_alloc);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <trace/hooks/mm.h>
|
||||
#include <asm/page.h>
|
||||
#include "internal.h"
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
void __attribute__((weak)) arch_report_meminfo(struct seq_file *m)
|
||||
{
|
||||
@@ -159,6 +160,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
|
||||
show_val_kb(m, "CmaFree: ",
|
||||
global_zone_page_state(NR_FREE_CMA_PAGES));
|
||||
#endif
|
||||
trace_android_vh_meminfo_proc_show(m);
|
||||
|
||||
#ifdef CONFIG_UNACCEPTED_MEMORY
|
||||
show_val_kb(m, "Unaccepted: ",
|
||||
|
||||
@@ -100,7 +100,22 @@ DECLARE_HOOK(android_vh_look_around,
|
||||
TP_PROTO(struct page_vma_mapped_walk *pvmw, struct folio *folio,
|
||||
struct vm_area_struct *vma, int *referenced),
|
||||
TP_ARGS(pvmw, folio, vma, referenced));
|
||||
|
||||
DECLARE_HOOK(android_vh_meminfo_proc_show,
|
||||
TP_PROTO(struct seq_file *m),
|
||||
TP_ARGS(m));
|
||||
DECLARE_HOOK(android_vh_exit_mm,
|
||||
TP_PROTO(struct mm_struct *mm),
|
||||
TP_ARGS(mm));
|
||||
DECLARE_HOOK(android_vh_show_mem,
|
||||
TP_PROTO(unsigned int filter, nodemask_t *nodemask),
|
||||
TP_ARGS(filter, nodemask));
|
||||
DECLARE_HOOK(android_vh_print_slabinfo_header,
|
||||
TP_PROTO(struct seq_file *m),
|
||||
TP_ARGS(m));
|
||||
struct slabinfo;
|
||||
DECLARE_HOOK(android_vh_cache_show,
|
||||
TP_PROTO(struct seq_file *m, struct slabinfo *sinfo, struct kmem_cache *s),
|
||||
TP_ARGS(m, sinfo, s));
|
||||
DECLARE_HOOK(android_vh_count_workingset_refault,
|
||||
TP_PROTO(struct folio *folio),
|
||||
TP_ARGS(folio));
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
|
||||
#include <asm/unistd.h>
|
||||
#include <asm/mmu_context.h>
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
#include "exit.h"
|
||||
|
||||
@@ -568,6 +569,7 @@ static void exit_mm(void)
|
||||
task_unlock(current);
|
||||
mmap_read_unlock(mm);
|
||||
mm_update_next_owner(mm);
|
||||
trace_android_vh_exit_mm(mm);
|
||||
mmput(mm);
|
||||
if (test_thread_flag(TIF_MEMDIE))
|
||||
exit_oom_victim();
|
||||
|
||||
@@ -457,5 +457,6 @@ void __show_mem(unsigned int filter, nodemask_t *nodemask, int max_zone_idx)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
trace_android_vh_show_mem(filter, nodemask);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__show_mem);
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/kmem.h>
|
||||
#undef CREATE_TRACE_POINTS
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
enum slab_state slab_state;
|
||||
LIST_HEAD(slab_caches);
|
||||
@@ -1076,6 +1078,7 @@ static void print_slabinfo_header(struct seq_file *m)
|
||||
seq_puts(m, "# name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab>");
|
||||
seq_puts(m, " : tunables <limit> <batchcount> <sharedfactor>");
|
||||
seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
|
||||
trace_android_vh_print_slabinfo_header(m);
|
||||
seq_putc(m, '\n');
|
||||
}
|
||||
|
||||
@@ -1110,6 +1113,7 @@ static void cache_show(struct kmem_cache *s, struct seq_file *m)
|
||||
sinfo.limit, sinfo.batchcount, sinfo.shared);
|
||||
seq_printf(m, " : slabdata %6lu %6lu %6lu",
|
||||
sinfo.active_slabs, sinfo.num_slabs, sinfo.shared_avail);
|
||||
trace_android_vh_cache_show(m, &sinfo, s);
|
||||
seq_putc(m, '\n');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user