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 Signed-off-by: Liujie Xie <xieliujie@oppo.com> Change-Id: I62d8bb2b6650d8b187b433f97eb833ef0b784df1 Signed-off-by: Hyesoo Yu <hyesoo.yu@samsung.com>
This commit is contained in:
parent
9266b0d1be
commit
573ba7b6e6
@ -203,6 +203,12 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gic_set_affinity);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gic_v3_affinity_init);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterrupt_tasks);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterrupt_tasks_done);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_meminfo_proc_show);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_mm);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_slowpath);
|
||||
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_rvh_report_bug);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_watchdog_timer_softlockup);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_freeze_todo);
|
||||
|
@ -18,6 +18,7 @@
|
||||
#endif
|
||||
#include <asm/page.h>
|
||||
#include "internal.h"
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
void __attribute__((weak)) arch_report_meminfo(struct seq_file *m)
|
||||
{
|
||||
@ -154,6 +155,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);
|
||||
|
||||
hugetlb_report_meminfo(m);
|
||||
|
||||
|
@ -45,6 +45,25 @@ DECLARE_HOOK(android_vh_page_add_new_anon_rmap,
|
||||
TP_PROTO(struct page *page, struct vm_area_struct *vma,
|
||||
unsigned long address),
|
||||
TP_ARGS(page, vma, address));
|
||||
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_alloc_pages_slowpath,
|
||||
TP_PROTO(gfp_t gfp_mask, unsigned int order, unsigned long delta),
|
||||
TP_ARGS(gfp_mask, order, delta));
|
||||
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));
|
||||
|
||||
#endif /* _TRACE_HOOK_MM_H */
|
||||
|
||||
|
@ -72,6 +72,7 @@
|
||||
#include <linux/uaccess.h>
|
||||
#include <asm/unistd.h>
|
||||
#include <asm/mmu_context.h>
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
/*
|
||||
* The default value should be high enough to not crash a system that randomly
|
||||
@ -560,6 +561,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();
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <linux/mm.h>
|
||||
#include <linux/cma.h>
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
void __show_mem(unsigned int filter, nodemask_t *nodemask, int max_zone_idx)
|
||||
{
|
||||
@ -41,4 +42,5 @@ void __show_mem(unsigned int filter, nodemask_t *nodemask, int max_zone_idx)
|
||||
#ifdef CONFIG_MEMORY_FAILURE
|
||||
printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
|
||||
#endif
|
||||
trace_android_vh_show_mem(filter, nodemask);
|
||||
}
|
||||
|
@ -76,6 +76,8 @@
|
||||
#include <linux/khugepaged.h>
|
||||
#include <linux/buffer_head.h>
|
||||
#include <linux/delayacct.h>
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
#include <asm/sections.h>
|
||||
#include <asm/tlbflush.h>
|
||||
#include <asm/div64.h>
|
||||
@ -5116,7 +5118,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
|
||||
unsigned int cpuset_mems_cookie;
|
||||
unsigned int zonelist_iter_cookie;
|
||||
int reserve_flags;
|
||||
|
||||
unsigned long alloc_start = jiffies;
|
||||
/*
|
||||
* We also sanity check to catch abuse of atomic reserves being used by
|
||||
* callers that are not in atomic context.
|
||||
@ -5381,6 +5383,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
|
||||
warn_alloc(gfp_mask, ac->nodemask,
|
||||
"page allocation failure: order:%u", order);
|
||||
got_pg:
|
||||
trace_android_vh_alloc_pages_slowpath(gfp_mask, order, alloc_start);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,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);
|
||||
@ -1200,6 +1202,7 @@ static void print_slabinfo_header(struct seq_file *m)
|
||||
seq_puts(m, " : globalstat <listallocs> <maxobjs> <grown> <reaped> <error> <maxfreeable> <nodeallocs> <remotefrees> <alienoverflow>");
|
||||
seq_puts(m, " : cpustat <allochit> <allocmiss> <freehit> <freemiss>");
|
||||
#endif
|
||||
trace_android_vh_print_slabinfo_header(m);
|
||||
seq_putc(m, '\n');
|
||||
}
|
||||
|
||||
@ -1235,6 +1238,7 @@ static void cache_show(struct kmem_cache *s, struct seq_file *m)
|
||||
seq_printf(m, " : slabdata %6lu %6lu %6lu",
|
||||
sinfo.active_slabs, sinfo.num_slabs, sinfo.shared_avail);
|
||||
slabinfo_show_stats(m, s);
|
||||
trace_android_vh_cache_show(m, &sinfo, s);
|
||||
seq_putc(m, '\n');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user